Package co.ankatech.ankasecure.sdk.model
Class MigrationWorkflowResult
java.lang.Object
co.ankatech.ankasecure.sdk.model.MigrationWorkflowResult
Immutable response model returned by combined PKCS#7 migration workflows.
This class encapsulates the results of a complete PKCS#7 to JOSE migration workflow that includes both analysis and conversion steps. It provides access to the full analysis metadata (signers, recipients, transformations) as well as the resulting JOSE output file.
Workflow pattern
This result is typically returned by convenience methods that perform the complete migration workflow in a single call:- Analyze PKCS#7 file to understand structure and requirements
- Convert PKCS#7 to JOSE format (streaming)
- Return combined results
Phase 2.1 Note
Due to the Phase 2.1 USPTO Patent Architecture, the streaming conversion endpoint returns raw JOSE output without metadata. Therefore, this class combines the analysis results (which contain all metadata) with the conversion output file.Usage example
var conversionReq = new Pkcs7ConversionStreamRequest()
.serialization("AUTO")
.targetFormat("AUTO");
MigrationWorkflowResult result = sdk.performMigrationWorkflow(
new File("legacy.p7m"),
conversionReq,
new File("output.jose")
);
// Access analysis metadata
System.out.println("Signers: " + result.getAnalysis().getSigners().size());
System.out.println("Recipients: " + result.getAnalysis().getRecipients().size());
// Access JOSE output
System.out.println("JOSE file: " + result.getJoseOutput().getAbsolutePath());
System.out.println("File size: " + result.getJoseOutput().length());
// Check if key import is needed
if (result.requiresKeyImport()) {
System.out.println("WARNING: Import required private keys before using JOSE output");
}
Thread-safety
Instances are immutable data carriers after construction and may be shared across threads safely, provided no mutator is invoked.
All getters return non-null values.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for SDK internal use.MigrationWorkflowResult(co.ankatech.secure.client.model.Pkcs7AnalysisResponse analysis, File joseOutput) Constructs a new migration workflow result with the specified analysis and JOSE output. -
Method Summary
Modifier and TypeMethodDescriptionco.ankatech.secure.client.model.Pkcs7AnalysisResponseReturns the complete PKCS#7 analysis response.Returns the output file containing converted JOSE data.booleanChecks if the analyzed PKCS#7 file requires private key imports.toString()Returns a human-readable summary of the migration workflow results.
-
Constructor Details
-
MigrationWorkflowResult
public MigrationWorkflowResult()Default constructor for SDK internal use. -
MigrationWorkflowResult
public MigrationWorkflowResult(co.ankatech.secure.client.model.Pkcs7AnalysisResponse analysis, File joseOutput) Constructs a new migration workflow result with the specified analysis and JOSE output.- Parameters:
analysis- the PKCS#7 analysis response containing metadatajoseOutput- the file containing converted JOSE output
-
-
Method Details
-
getAnalysis
public co.ankatech.secure.client.model.Pkcs7AnalysisResponse getAnalysis()Returns the complete PKCS#7 analysis response.The analysis contains:
- Detected format information (standard, structure, encoding)
- Signer metadata (certificates, algorithms, timestamps)
- Recipient metadata (if encrypted)
- Encryption details
- Support status and recommendations
- Returns:
- non-null analysis response
-
getJoseOutput
Returns the output file containing converted JOSE data.The file format varies based on the PKCS#7 type:
- SignedData → JWS detached JSON (application/octet-stream)
- EnvelopedData → JWE detached multipart (multipart/mixed)
- SignedAndEnvelopedData → JWE(JWS) nested detached (multipart/mixed)
- Returns:
- non-null File reference to JOSE output
-
requiresKeyImport
public boolean requiresKeyImport()Checks if the analyzed PKCS#7 file requires private key imports.Returns
trueif the analysis detected signers or encryption, indicating that private keys must be imported via PKCS#12 before the converted JOSE output can be used for cryptographic operations.- Returns:
- true if key import is required, false otherwise
-
toString
Returns a human-readable summary of the migration workflow results.Useful for logging and debugging purposes.
-