Class Pkcs7ExampleFixture

java.lang.Object
co.ankatech.ankasecure.sdk.examples.Pkcs7ExampleFixture

public final class Pkcs7ExampleFixture extends Object
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 Details

    • envelopedDataBytes

      public static byte[] envelopedDataBytes()
      Loads the raw DER bytes of the packaged EnvelopedData fixture from the classpath.
      Returns:
      the fixture bytes (never null or empty)
      Throws:
      IllegalStateException - if the resource is missing from the classpath
      UncheckedIOException - if the resource cannot be read
    • envelopedDataBase64

      public static String envelopedDataBase64()
      Returns the fixture as a Base64 string, suitable for the compact-mode request fields Pkcs7AnalysisRequest.pkcs7Data / Pkcs7ConversionRequest.pkcs7Data.
      Returns:
      Base64-encoded fixture bytes
    • materializeToTempFile

      public static File materializeToTempFile()
      Materializes the fixture to a temporary File under ExampleUtil.TEMP_DIR, for the streaming APIs that take a java.io.File.
      Returns:
      a readable temp File containing the fixture bytes
      Throws:
      UncheckedIOException - if the temp file cannot be written