SignedData ContentInfo
type, where to the type of data signed is plain Data.
For signedData, crls, attributes and
PKCS#6 Extended Certificates are not supported.
| Modifier and Type | Field and Description |
|---|---|
| private X509Certificate[] | |
| private Principal[] | |
| private ContentInfo | |
| private X509CRL[] | |
| private AlgorithmId[] | |
| private boolean | |
| private SignerInfo[] | |
| private BigInteger |
| Access | Constructor and Description |
|---|---|
| public | PKCS7(InputStream
an input stream holding at least one PKCS7 block. in)Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes from the InputStream. |
| public | PKCS7(DerInputStream
a DerInputStream holding at least one PKCS7 block. derin)Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes from the DerInputStream. |
| public | PKCS7(byte[]
the encoded bytes. bytes)Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes. |
| public | PKCS7(AlgorithmId[]
the message digest algorithm identifiers. digestAlgorithmIds, ContentInfo the content information. contentInfo, X509Certificate[] an array of X.509 certificates. certificates, X509CRL[] an array of CRLs crls, SignerInfo[] an array of signer information. signerInfos)Construct an initialized PKCS7 block. |
| public | PKCS7(AlgorithmId[] digestAlgorithmIds, ContentInfo contentInfo, X509Certificate[] certificates, SignerInfo[] signerInfos)
|
| Modifier and Type | Method and Description |
|---|---|
| private static byte[] | Returns: the token in a byte arraythe signature signature, X509Certificate[] the signer's certificate chain signerChain, byte[] (optional) encapsulated content content, PKCS9Attributes (optional) authenticated attributes authAttrs, PKCS9Attributes (optional) unauthenticated attributes unauthAttrs, AlgorithmId digest algorithm identifier digAlgID, AlgorithmId encryption algorithm identifier encAlgID)Assemble a PKCS7 token from its components |
| public void | encodeSignedData(DerOutputStream
the DerOutputStream to write the encoded data to. out)Encodes the signed data to a DerOutputStream. |
| public static byte[] | generateSignedData(String sigalg, Provider sigProvider, PrivateKey privateKey, X509Certificate[] signerChain, byte[] content, boolean internalsf, boolean directsign, Function<byte[], PKCS9Attributes> ts)
|
| public static byte[] | Returns: the pkcs7 output in an arraysignature algorithm to be used sigalg, Provider (optional) provider sigProvider, PrivateKey signer's private key privateKey, X509Certificate[] signer's certificate chain signerChain, byte[] the content to sign content, boolean whether the content should be included in output internalsf, boolean if the content is signed directly or through authattrs directsign, AlgorithmId digest alg to use; derive from other arguments if null digAlgID, Function<byte[], PKCS9Attributes> (optional) timestamper ts)Generate a PKCS7 data block. |
| public static byte[] | Returns: the encoded timestamp tokenthe timestamping authority to use tsa, String the TSAPolicyID of the Timestamping Authority as a
numerical object identifier; or null if we leave the TSA server
to choose one tSAPolicyID, String tSADigestAlg, byte[] the token that is to be timestamped toBeTimestamped)Requests, processes and validates a timestamp token from a TSA using common defaults. |
| public X509Certificate | getCertificate(BigInteger
the serial number of the certificate to retrieve. serial, X500Name the Distinguished Name of the Issuer. issuerName)Returns the X.509 certificate listed in this PKCS7 block which has a matching serial number and Issuer name, or null if one is not found. |
| public X509Certificate[] | Returns: a clone of the array of X.509 certificates or null if none are specified for the content type.Returns the X.509 certificates listed in this PKCS7 block. |
| public ContentInfo | |
| public X509CRL[] | Returns: a clone of the array of X.509 crls or null if none are specified for the content type.Returns the X.509 crls listed in this PKCS7 block. |
| public AlgorithmId[] | Returns: the array of Digest Algorithms or null if none are specified for the content type.Returns the message digest algorithms specified in this PKCS7 block. |
| public SignerInfo[] | Returns: the array of Signer Infos or null if none are specified for the content type.Returns the signer's information specified in this PKCS7 block. |
| public static URI | Returns: An HTTP or HTTPS URI or null if none was found.(optional) X.509 certificate for the TSA. tsaCertificate)Examine the certificate for a Subject Information Access extension (RFC 5280). |
| public BigInteger | Returns: the version or null if version is not specified for the content type.Returns the version number of this PKCS7 block. |
| public boolean | |
| private void | |
| private void | parse(DerInputStream
the ASN.1 encoding of the PKCS#7 block. derin, boolean flag indicating whether the given PKCS#7 block
is encoded according to JDK1.1.x. oldStyle)Parses a PKCS#7 block. |
| private void | |
| private void | |
| private void | |
| private void | populateCertIssuerNames()
Populate array of Issuer DNs from certificates and convert each Principal to type X500Name if necessary. |
| public String | |
| public SignerInfo | verify(SignerInfo
the signer information. info, byte[] the DER encoded content information. bytes)This verifies a given SignerInfo. |
| public SignerInfo | verify(SignerInfo
the signer information. info, byte[] the DER encoded content information. bytes, X509Certificate certificate used to verify; find one inside the block if null cert)This verifies a given SignerInfo. |
| public SignerInfo[] |
| certificates | back to summary |
|---|---|
| private X509Certificate[] certificates | |
| certIssuerNames | back to summary |
|---|---|
| private Principal[] certIssuerNames | |
| contentInfo | back to summary |
|---|---|
| private ContentInfo contentInfo | |
| crls | back to summary |
|---|---|
| private X509CRL[] crls | |
| digestAlgorithmIds | back to summary |
|---|---|
| private AlgorithmId[] digestAlgorithmIds | |
| oldStyle | back to summary |
|---|---|
| private boolean oldStyle | |
| signerInfos | back to summary |
|---|---|
| private SignerInfo[] signerInfos | |
| version | back to summary |
|---|---|
| private BigInteger version | |
| PKCS7 | back to summary |
|---|---|
| public PKCS7(InputStream in) throws IOException Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes from the InputStream.
| |
| PKCS7 | back to summary |
|---|---|
| public PKCS7(DerInputStream derin) throws ParsingException Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes from the DerInputStream.
| |
| PKCS7 | back to summary |
|---|---|
| public PKCS7(byte[] bytes) throws ParsingException Unmarshals a PKCS7 block from its encoded form, parsing the encoded bytes.
| |
| PKCS7 | back to summary |
|---|---|
| public PKCS7(AlgorithmId[] digestAlgorithmIds, ContentInfo contentInfo, X509Certificate[] certificates, X509CRL[] crls, SignerInfo[] signerInfos) Construct an initialized PKCS7 block.
| |
| PKCS7 | back to summary |
|---|---|
| public PKCS7(AlgorithmId[] digestAlgorithmIds, ContentInfo contentInfo, X509Certificate[] certificates, SignerInfo[] signerInfos) | |
| constructToken | back to summary |
|---|---|
| private static byte[] constructToken(byte[] signature, X509Certificate[] signerChain, byte[] content, PKCS9Attributes authAttrs, PKCS9Attributes unauthAttrs, AlgorithmId digAlgID, AlgorithmId encAlgID) throws IOException Assemble a PKCS7 token from its components
| |
| encodeSignedData | back to summary |
|---|---|
| public void encodeSignedData(DerOutputStream out) throws IOException Encodes the signed data to a DerOutputStream.
| |
| generateSignedData | back to summary |
|---|---|
| public static byte[] generateSignedData(String sigalg, Provider sigProvider, PrivateKey privateKey, X509Certificate[] signerChain, byte[] content, boolean internalsf, boolean directsign, Function<byte[], PKCS9Attributes> ts) throws SignatureException, InvalidKeyException, IOException, NoSuchAlgorithmException | |
| generateSignedData | back to summary |
|---|---|
| public static byte[] generateSignedData(String sigalg, Provider sigProvider, PrivateKey privateKey, X509Certificate[] signerChain, byte[] content, boolean internalsf, boolean directsign, AlgorithmId digAlgID, Function<byte[], PKCS9Attributes> ts) throws SignatureException, InvalidKeyException, IOException, NoSuchAlgorithmException Generate a PKCS7 data block.
| |
| generateTimestampToken | back to summary |
|---|---|
| public static byte[] generateTimestampToken(Timestamper tsa, String tSAPolicyID, String tSADigestAlg, byte[] toBeTimestamped) throws IOException, CertificateException Requests, processes and validates a timestamp token from a TSA using common defaults. Uses the following defaults in the timestamp request: SHA-1 for the hash algorithm, a 64-bit nonce, and request certificate set to true.
| |
| getCertificate | back to summary |
|---|---|
| public X509Certificate getCertificate(BigInteger serial, X500Name issuerName) Returns the X.509 certificate listed in this PKCS7 block which has a matching serial number and Issuer name, or null if one is not found.
| |
| getCertificates | back to summary |
|---|---|
| public X509Certificate[] getCertificates() Returns the X.509 certificates listed in this PKCS7 block.
| |
| getContentInfo | back to summary |
|---|---|
| public ContentInfo getContentInfo() Returns the content information specified in this PKCS7 block. | |
| getCRLs | back to summary |
|---|---|
| public X509CRL[] getCRLs() Returns the X.509 crls listed in this PKCS7 block.
| |
| getDigestAlgorithmIds | back to summary |
|---|---|
| public AlgorithmId[] getDigestAlgorithmIds() Returns the message digest algorithms specified in this PKCS7 block.
| |
| getSignerInfos | back to summary |
|---|---|
| public SignerInfo[] getSignerInfos() Returns the signer's information specified in this PKCS7 block.
| |
| getTimestampingURI | back to summary |
|---|---|
| public static URI getTimestampingURI(X509Certificate tsaCertificate) Examine the certificate for a Subject Information Access extension
(RFC 5280).
The extension's
| |
| getVersion | back to summary |
|---|---|
| public BigInteger getVersion() Returns the version number of this PKCS7 block.
| |
| isOldStyle | back to summary |
|---|---|
| public boolean isOldStyle() Returns true if this is a JDK1.1.x-style PKCS#7 block, and false otherwise. | |
| parse | back to summary |
|---|---|
| private void parse(DerInputStream derin) throws ParsingException | |
| parse | back to summary |
|---|---|
| private void parse(DerInputStream derin, boolean oldStyle) throws IOException Parses a PKCS#7 block.
| |
| parseNetscapeCertChain | back to summary |
|---|---|
| private void parseNetscapeCertChain(DerValue val) throws IOException | |
| parseOldSignedData | back to summary |
|---|---|
| private void parseOldSignedData(DerValue val) throws IOException | |
| parseSignedData | back to summary |
|---|---|
| private void parseSignedData(DerValue val) throws IOException | |
| populateCertIssuerNames | back to summary |
|---|---|
| private void populateCertIssuerNames() Populate array of Issuer DNs from certificates and convert each Principal to type X500Name if necessary.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the PKCS7 block in a printable string form. | |
| verify | back to summary |
|---|---|
| public SignerInfo verify(SignerInfo info, byte[] bytes) throws NoSuchAlgorithmException, SignatureException This verifies a given SignerInfo.
| |
| verify | back to summary |
|---|---|
| public SignerInfo verify(SignerInfo info, byte[] bytes, X509Certificate cert) throws NoSuchAlgorithmException, SignatureException This verifies a given SignerInfo.
| |
| verify | back to summary |
|---|---|
| public SignerInfo[] verify(byte[] bytes) throws NoSuchAlgorithmException, SignatureException Returns all signerInfos which self-verify.
| |