VC Encryption Process

Apply VC Process
This process defines the secure exchange of data between a Holder and an Issuer in the Verifiable Credential (VC) system. The encryption model uses a hybrid scheme, combining asymmetric RSA encryption for key exchange and symmetric AES/GCM encryption (with HMAC-SHA256) for securing data. Additionally, a shared key is established using the X25519 Diffie-Hellman key exchange protocol to ensure end-to-end confidentiality between the Holder and Issuer.
Steps Overview
ECDH Key Generation (Holder): The Holder generates an Elliptic Curve Diffie-Hellman (ECDH) key using the Issuer’s public key and the Holder’s private key.
Application Data Encryption: The Holder encrypts the VC application data using AES with the derived ECDH key.
ECDH Key Encryption (RSA): The Holder encrypts the ECDH key using the Issuer’s RSA public key for secure transmission.
Submit Encrypted Data: The Holder sends the encrypted application data, encrypted ECDH key, signed data, metadata, public key, and X25519 public key to the MS Credential service via a
POST /vc/applyrequest.ECDH Key Decryption (Server): The MS Credential service decrypts the ECDH key using its RSA private key.
Application Data Decryption: Using the decrypted ECDH key, the service decrypts the encrypted application data.
Template Metadata Validation: The service validates the metadata against the template to ensure integrity.
Data Storage (Redis): The service stores the encrypted application data along with the Holder’s DID and X25519 public key in Redis as an APPLIED record.
Issuer Fetch Request: The Issuer retrieves the Holder’s DID and X25519 public key by calling
GET /vc?vclId=.ECDH Key Generation (Issuer): The Issuer generates its ECDH key using the Holder’s public key and its own private key to establish the shared secret.

Issue and Download VC Process
This process defines how a Verifiable Credential (VC) is securely issued by the Issuer and later downloaded by the Holder. Like the Apply VC Process, this stage uses hybrid encryption combining RSA (for exchanging ECDH keys), AES/GCM with HMAC-SHA256 (for encrypting data), and Diffie-Hellman with X25519 for shared key generation. It also introduces ED25519 and BBS+ signatures for signing and verification.
Fetching and Key Setup
The Issuer fetches the Holder’s X25519 public key and DID (
GET /holder?vcld=).The Issuer generates an ECDH key using the Holder’s public key and the Issuer’s private key.
Issuance data is encrypted using AES with the ECDH key.
The ECDH key itself is encrypted using the Holder’s RSA public key.
Sending Encrypted Issuance Data
The Issuer sends the encrypted issuance data and encrypted ECDH key to the MS Credential service (POST
/vc/create).The service decrypts the ECDH key with its RSA private key.
The service decrypts the issuance data with the ECDH key.
The service also decrypts the Holder’s earlier apply data.
Metadata from Holder and Issuer are merged.
The template metadata is validated.
A VC blob is created and returned to the Issuer.
Signing and Submitting VC Data
The MS Credential service updates the encrypted apply VC data as PENDING_SIGN.
The Issuer signs the blob with ED25519 and BBS+ keys.
The Issuer encrypts the post VC data using AES with the ECDH key.
The Issuer encrypts the ECDH key using the Holder’s RSA public key.
The Issuer submits encrypted VC data, including the VC ID, ED25519 public key, ED25519 signature, BBS public key, BBS signature, expiry, and the encrypted ECDH key (
POST /vc/submit).
Final VC Issuance
MS Credential decrypts the ECDH key with its RSA private key.
It decrypts the submitted VC data using AES with the ECDH key.
It creates and verifies the final VC.
The VC is encrypted again using AES with the ECDH key.
The encrypted VC is stored in Redis as ISSUED.
Download by Holder
The Holder downloads the encrypted VC using POST
/vc/downloadwith payload including VC ID, Issuer ID, and signed VC ID.The Holder generates the ECDH key using the Issuer’s public key and the Holder’s private key.
The Holder decrypts the VC using AES with the derived ECDH key and stores it locally.

Create and Verify VP Process
This process enables a Holder to generate a Verifiable Presentation (VP) from their issued Verifiable Credential (VC) and securely share it with a Verifier. It uses a combination of RSA for key exchange, AES/GCM with HMAC-SHA256 for encryption, X25519 ECDH for shared keys, and ED25519 for signing.
VP Creation by Holder
The Holder generates an ECDH key using their private key and the Verifier’s public key.
The Holder encrypts the VC using AES with the generated ECDH key.
The ECDH key is encrypted using the Verifier’s RSA public key.
The Holder sends the encrypted VC, reveal attributes, and range proof to MS Credential (
POST /vp/create).
Processing at MS Credential
MS Credential decrypts the ECDH key using its RSA private key.
MS Credential decrypts the VC using AES with the ECDH key.
MS Credential creates a blob and returns the blob to the Holder.
Holder Preparing VP Submission
The Holder signs the blob with their ED25519 private key.
The Holder encrypts the ECDH key again using the Verifier’s RSA public key.
The Holder sends the encrypted VP, including
blobId, signed blob, ED25519 public key, and encrypted ECDH key, to MS Credential (POST/vp/submit).
Storing VP in Redis
MS Credential decrypts the ECDH key using its RSA private key.
MS Credential creates the VP and validates its parameters.
MS Credential encrypts the VP using AES with the ECDH key.
MS Credential stores the encrypted VP in Redis and returns a UUID to the Holder.
Sharing with Verifier
The Holder shares the UUID and their public key in a QR Code with the Verifier.
Verifier Verification Process
The Verifier generates an ECDH key using its private key and the Holder’s public key.
The Verifier encrypts the ECDH key using the Holder’s RSA public key.
The Verifier fetches the encrypted VP from Redis using the UUID.
The Verifier sends the VP data to the verification API with the UUID and encrypted ECDH key (POST
/vp/verify).
Final Verification by MS Credential
MS Credential fetches the encrypted VP from Redis.
MS Credential decrypts the encrypted VP using its RSA private key and the ECDH key.
MS Credential verifies the VP and returns the verification status to the Verifier.
Last updated