public class

PKCS7

extends Object
java.lang.Object
   ↳ com.pspdfkit.signatures.contents.PKCS7

Class Overview

A representation of a PKCS7 structure that can be contained in a digital signature field.

For example, you can use an instance of this class when you want to sign a document that was already prepared for deferred digital signing. One example scenario may be the following:

  1. Prepare a PDF document with a digital signature form field by calling prepareFormFieldForSigningAsync(SignerOptions).
  2. Embed the data contents of this container by calling embedSignatureInFormFieldAsync(SignatureFormField, SignatureContents, OutputStream). In your custom implementation of the SignatureContents interface that you pass to this method, you can return getPKCS7EncodedData() from inside the signData(byte[]) method.

Summary

Public Methods
static PKCS7 create(byte[] digest, KeyStore.PrivateKeyEntry privateKey, HashAlgorithm hashAlgorithm)
This method is deprecated. Please use create(byte[], KeyStore.PrivateKeyEntry, HashAlgorithm, FilterSubtype) instead, which replaces this method.
static PKCS7 create(byte[] digest, KeyStore.PrivateKeyEntry privateKey, HashAlgorithm hashAlgorithm, FilterSubtype filterSubtype)
Creates an instance of a PKCS7 container.
byte[] getPKCS7EncodedData()
Returns PKCS7 container as raw byte array.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static PKCS7 create (byte[] digest, KeyStore.PrivateKeyEntry privateKey, HashAlgorithm hashAlgorithm)

This method is deprecated.
Please use create(byte[], KeyStore.PrivateKeyEntry, HashAlgorithm, FilterSubtype) instead, which replaces this method.

Creates an instance of a PKCS7 container with a filter subtype set to ADOBE_PKCS7_DETACHED.

Parameters
digest The digest data that will be cryptographically protected by this PKCS7. For digital signatures this is typically hash of the PDF document except the signature contents.
privateKey The private key that will be used to encrypt the digest.
hashAlgorithm The hash algorithm that was used to hash the digest argument.

public static PKCS7 create (byte[] digest, KeyStore.PrivateKeyEntry privateKey, HashAlgorithm hashAlgorithm, FilterSubtype filterSubtype)

Creates an instance of a PKCS7 container.

Parameters
digest The digest data that will be cryptographically protected by this PKCS7. For digital signatures this is typically hash of the PDF document except the signature contents.
privateKey The private key that will be used to encrypt the digest.
hashAlgorithm The hash algorithm that was used to hash the digest argument.
filterSubtype Filter subtype for encoding or format that will be used to create the signature.

public byte[] getPKCS7EncodedData ()

Returns PKCS7 container as raw byte array.