Skip to content

Let cryptogen set attributes in certificates#5417

Open
johannww wants to merge 1 commit intohyperledger:mainfrom
johannww:cryptogen-cert-attrs
Open

Let cryptogen set attributes in certificates#5417
johannww wants to merge 1 commit intohyperledger:mainfrom
johannww:cryptogen-cert-attrs

Conversation

@johannww
Copy link
Contributor

This extends cryptogen functionality and allows testing ABAC chaincodes with cryptogen credentials. All defined non-admin users earn all attributes.

Type of change

  • New feature

Description

Extends cryptogen to embed user-defined attributes into X.509 certificates as a custom extension (OID 1.2.3.4.5.6.7.8.1), using the same JSON format as fabric-ca. This enables ABAC chaincode testing with cryptogen-generated credentials without requiring a Fabric CA.

This is useful for fast testing environments, without the requirement to boot a CA up and make requests user by user.

Changes:

  • NodeSpec and UsersSpec gain an Attrs map[string]string YAML field
  • CA.SignCertificate accepts and embeds attributes via a new pkix.Extension
  • msp.GenerateLocalMSP forwards attributes to the signing step (TLS certs are unaffected)
  • Sample config updated with an abac.creator: "true" example under Users.Attrs
  • Tests updated to cover the new signature and verify the extension is correctly serialized

Additional details

Unit tests were added and some generations were run and tested in a kubernetes deploy.

Release Note

Users' cryptogen-generated certs will have the attribute abac.creator set to true by default.

This extends cryptogen functionality and allows testing ABAC
chaincodes with cryptogen credentials. All defined non-admin users
earn all attributes.

Signed-off-by: Johann Westphall <johannwestphall@gmail.com>
@johannww johannww requested a review from a team as a code owner March 12, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant