public class CadesSignature extends AbstractCadesSignature
CadesSignature cadesSig = new CadesSignature(data, SignedData.EXPLICIT); CadesBESParameters params = new CadesBESParameters(); cadesSig.addSignerInfo(privKey_, certs, params); byte[] signature = cadesSig.encodeSignature();
Constructor and Description |
---|
CadesSignature(byte[] signature)
Create a new instance by providing only the bytes of the signature.
|
CadesSignature(byte[] signature,
byte[] signedContent)
Create a new instance by providing the bytes of the signature and the signed content.
|
CadesSignature(byte[] signature,
byte[] signedContent,
int signedDataMode)
Create a new instance by providing the bytes of the signature and the signed content.
|
CadesSignature(byte[] signature,
byte[] signedContent,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the bytes of the signature and the signed content.
|
CadesSignature(byte[] signature,
byte[] signedContent,
java.lang.String[] additionalContentDigestAlgs,
int signedDataMode,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the bytes of the signature and the signed content.
|
CadesSignature(byte[] signature,
byte[] signedContent,
java.lang.String[] additionalContentDigestAlgs,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the bytes of the signature and the signed content.
|
CadesSignature(byte[] signature,
java.io.InputStream signedContent)
Create a new instance by providing the signature as bytes and signed content as stream.
|
CadesSignature(byte[] signature,
java.io.InputStream signedContent,
int signedDataMode)
Create a new instance by providing the signature as bytes and signed content as stream.
|
CadesSignature(byte[] signature,
java.io.InputStream signedContent,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature as bytes and signed content as stream.
|
CadesSignature(byte[] signature,
java.io.InputStream signedContent,
java.lang.String[] additionalContentDigestAlgs,
int signedDataMode,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature as bytes and signed content as stream.
|
CadesSignature(byte[] signature,
java.io.InputStream signedContent,
java.lang.String[] additionalContentDigestAlgs,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature as bytes and signed content as stream.
|
CadesSignature(byte[] data,
int mode)
New instance creating a signed data object for the given data and mode.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
encodeSignature()
Returns the encoded CMS signature.
|
byte[] |
getEncodedSignedData()
Deprecated.
use
encodeSignature() for new signatures and
AbstractCadesSignature.encodeUpgradedSignature() for upgraded signatures (e.g. upgraded with
archive timestamps) |
addArchiveTimeStamp, addArchiveTimeStamp, addSignerInfo, encodeUpgradedSignature, getArchiveTimeStamps, getArchiveTimeStamps, getContentTimeStamps, getContentTimeStamps, getCRL, getSignatureTimeStamps, getSignatureTimeStamps, getSignatureTimeStampToken, getSignatureTimeStampToken, getSignedDataObject, getSignerInfos, verifySignatureTimestampImprint, verifySignatureTimestampImprint, verifySignatureTimestampImprint, verifySignatureTimestampImprint, verifySignatureValue, verifySignatureValue, verifySignatureValue
public CadesSignature(byte[] data, int mode)
data
- Bytes of data to be signedmode
- SignedData.IMPLICIT or SignedData.EXPLICITpublic CadesSignature(byte[] signature, java.io.InputStream signedContent) throws CmsCadesException
signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signaturesCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, java.io.InputStream signedContent, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) and not yet included content digests are required,
these additional digest algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signaturesnewSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, java.io.InputStream signedContent, java.lang.String[] additionalContentDigestAlgs, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) will be encoded to the given output stream. If not
yet
included content digests are required for upgrading the signature, these additional digest
algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signaturesadditionalContentDigestAlgs
- digest algorithms that shall be added to the signature for later usagenewSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, java.io.InputStream signedContent, int signedDataMode) throws CmsCadesException
signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signaturessignedDataMode
- SignedData.EXPLICIT or SignedData.IMPLICITCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, java.io.InputStream signedContent, java.lang.String[] additionalContentDigestAlgs, int signedDataMode, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) will be encoded to the given output stream. If not
yet
included content digests are required for upgrading the signature, these additional digest
algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signaturesadditionalContentDigestAlgs
- digest algorithms that shall be added to the signature for later usagesignedDataMode
- SignedData.EXPLICIT or SignedData.IMPLICITnewSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, byte[] signedContent) throws CmsCadesException
signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signatures. If given
for an implicit signature, the signature content must match the given content.CmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, byte[] signedContent, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) and not yet included content digests are required,
these additional digest algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signatures. If given
for an implicit signature, the signature content must match the given content.newSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, byte[] signedContent, java.lang.String[] additionalContentDigestAlgs, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) will be encoded to the given output stream. If not
yet included content digests are required for upgrading the signature, these additional digest
algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signatures. If given
for an implicit signature, the signature content must match the given content.additionalContentDigestAlgs
- digest algorithms that shall be added to the signature for later usagenewSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, byte[] signedContent, int signedDataMode) throws CmsCadesException
signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signatures. If given
for an implicit signature, the signature content must match the given content.signedDataMode
- SignedData.EXPLICIT or SignedData.IMPLICITCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature, byte[] signedContent, java.lang.String[] additionalContentDigestAlgs, int signedDataMode, java.io.OutputStream newSignatureEncodingStream) throws CmsCadesException
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
) will be encoded to the given output stream. If not
yet included content digests are required for upgrading the signature, these additional
digest algorithms for hashing the signed content have to be specified here.
Used for signature verification and upgrade with unsigned attributes.signature
- signature as encoded SignedData objectsignedContent
- the content signed by the given signature, required for explicit signatures. If given
for an implicit signature, the signature content must match the given content.additionalContentDigestAlgs
- digest algorithms that shall be added to the signature for later usagesignedDataMode
- SignedData.EXPLICIT or SignedData.IMPLICITnewSignatureEncodingStream
- output stream to write the encoding of the new upgraded signatureCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public CadesSignature(byte[] signature) throws CmsCadesException
signature
- signature as encoded SignedData objectCmsCadesException
- if signature is invalid (e.g. can't be parsed or content hash doesn't match)public byte[] getEncodedSignedData() throws java.io.IOException, CmsCadesException
encodeSignature()
for new signatures and
AbstractCadesSignature.encodeUpgradedSignature()
for upgraded signatures (e.g. upgraded with
archive timestamps)java.io.IOException
- if data can't be readCmsCadesException
- if signed data attributes or signed data object can't be createdpublic byte[] encodeSignature() throws java.io.IOException, CmsCadesException
CadesSignature(byte[], int)
.java.io.IOException
- if data can't be readCmsCadesException
- if signed data attributes or signed data object can't be created