Class ExampleScenario20
Converts a legacy PKCS#7/CMS EnvelopedData artifact to a modern JOSE JWE.
Unlike the keyless analysis in ExampleScenario19, conversion of EnvelopedData
requires the platform to actually decrypt the CMS envelope and re-wrap it —
so it needs the recipient's private key, referenced by its platform key id.
Where the recipient key comes from (control-plane prerequisite)
- The recipient key is matched by issuer DN + serial number, NOT by algorithm — so it cannot be discovered from the algorithm catalogue.
- Importing that key from a legacy keystore is a control-plane operation handled outside the data-plane SDK (the admin migration surface, an admin-scoped actor).
- This data-plane example therefore reads the resulting key id from the explicit
pkcs7.decryptionKidproperty and skips cleanly (before any server call) if it is absent.
Steps:
- Resolve the recipient key id from the
pkcs7.decryptionKidproperty (skips cleanly when blank) - Compact convert:
convertPkcs7ToJose(AUTO format → EnvelopedData becomes JWE) - Streaming convert:
convertPkcs7ToJoseStreamto a JWE output file - End-to-end:
performMigrationWorkflow(analyze + convert in one call)
Target-format contract
TargetFormatEnum.AUTO detects the structure: EnvelopedData → JWE, SignedData
→ JWS, both → nested. Forcing JWS on EnvelopedData is a 400 contract error
(there is no signature to convert); this example uses AUTO / JWE.
API Endpoints:
- POST /api/v3/migration/convert-pkcs7-to-jose (compact conversion)
- POST /api/v3/migration/stream/convert-pkcs7-to-jose (streaming conversion)
Prerequisite: a cli.properties for a data-plane actor, plus a
pkcs7.decryptionKid entry naming a recipient key already provisioned on the platform.
Until that key is provisioned the conversion calls will fail at the server; the analysis
counterpart ExampleScenario19 needs no key and runs unconditionally.
- Author:
- ANKATech Solutions Inc.
- See Also:
-
Method Summary
-
Method Details
-
main
Runs the PKCS#7 → JOSE conversion / migration scenario.- Parameters:
args- command-line arguments (ignored)
-