Class Pkcs7ExampleFixture
java.lang.Object
co.ankatech.ankasecure.sdk.examples.Pkcs7ExampleFixture
Classpath loader for the PKCS#7/CMS example fixture used by the data-plane
migration scenarios (
ExampleScenario19, ExampleScenario20).
The fixture /pkcs7/enveloped-data-sample.p7m is a small, non-sensitive
BER/DER-encoded CMS EnvelopedData structure (single recipient, zero signers)
produced by the QA test signer. It carries no private key material and no secret;
its encrypted payload is a throwaway QA value. It lives under
src/main/resources so the examples are self-contained and re-provision-safe
(the reader does not need to supply a PKCS#7 file to follow the walkthrough).
Loading the recipient's private key — required to actually decrypt and
convert the EnvelopedData to JWE — is a control-plane concern handled outside the
data-plane SDK (see ExampleScenario20); this helper only supplies the
ciphertext to analyze/convert.
- Author:
- ANKATech Solutions Inc.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the fixture as a Base64 string, suitable for the compact-mode request fieldsPkcs7AnalysisRequest.pkcs7Data/Pkcs7ConversionRequest.pkcs7Data.static byte[]Loads the raw DER bytes of the packaged EnvelopedData fixture from the classpath.static FileMaterializes the fixture to a temporaryFileunderExampleUtil.TEMP_DIR, for the streaming APIs that take ajava.io.File.
-
Method Details
-
envelopedDataBytes
public static byte[] envelopedDataBytes()Loads the raw DER bytes of the packaged EnvelopedData fixture from the classpath.- Returns:
- the fixture bytes (never
nullor empty) - Throws:
IllegalStateException- if the resource is missing from the classpathUncheckedIOException- if the resource cannot be read
-
envelopedDataBase64
Returns the fixture as a Base64 string, suitable for the compact-mode request fieldsPkcs7AnalysisRequest.pkcs7Data/Pkcs7ConversionRequest.pkcs7Data.- Returns:
- Base64-encoded fixture bytes
-
materializeToTempFile
Materializes the fixture to a temporaryFileunderExampleUtil.TEMP_DIR, for the streaming APIs that take ajava.io.File.- Returns:
- a readable temp
Filecontaining the fixture bytes - Throws:
UncheckedIOException- if the temp file cannot be written
-