public class CadesSignatureStream extends AbstractCadesSignature
CadesSignatureStream cadesSig = new CadesSignatureStream(data, SignedData.EXPLICIT); CadesBESParameters params = new CadesBESParameters(); cadesSig.addSignerInfo(privKey_, certs, params); OutputStream signature = new ByteArrayOutputStream(); cadesSig.encodeSignature(signature);
Constructor and Description |
---|
CadesSignatureStream(java.io.InputStream signature)
Create a new instance by providing only the signature as stream.
|
CadesSignatureStream(java.io.InputStream signature,
java.io.InputStream signedContent)
Create a new instance by providing the signature and signed content as stream.
|
CadesSignatureStream(java.io.InputStream signature,
java.io.InputStream signedContent,
int signedDataMode)
Create a new instance by providing the signature and signed content as stream.
|
CadesSignatureStream(java.io.InputStream signature,
java.io.InputStream signedContent,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature and signed content as stream.
|
CadesSignatureStream(java.io.InputStream signature,
java.io.InputStream signedContent,
java.lang.String[] additionalContentDigestAlgs,
int signedDataMode,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature and signed content as stream.
|
CadesSignatureStream(java.io.InputStream signature,
java.io.InputStream signedContent,
java.lang.String[] additionalContentDigestAlgs,
java.io.OutputStream newSignatureEncodingStream)
Create a new instance by providing the signature and signed content as stream.
|
CadesSignatureStream(java.io.InputStream data,
int mode)
New instance creating a signed data object for the given data and mode.
|
Modifier and Type | Method and Description |
---|---|
void |
encodeSignature(java.io.OutputStream os)
Writes the encoding of the CMS signature to the specified output stream.
|
java.io.ByteArrayOutputStream |
getEncodedSignedDataStream()
Deprecated.
the output stream to write the encoded signature should be specified by the user
instead of writing to a ByteArrayOutputStream. use
encodeSignature(OutputStream) 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 CadesSignatureStream(java.io.InputStream data, int mode)
data
- InputStream of data to be signedmode
- SignedData.IMPLICIT or SignedData.EXPLICITpublic CadesSignatureStream(java.io.InputStream 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 CadesSignatureStream(java.io.InputStream 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 CadesSignatureStream(java.io.InputStream 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 CadesSignatureStream(java.io.InputStream 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 CadesSignatureStream(java.io.InputStream 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 CadesSignatureStream(java.io.InputStream 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 java.io.ByteArrayOutputStream getEncodedSignedDataStream() throws java.io.IOException, CmsCadesException
encodeSignature(OutputStream)
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 void encodeSignature(java.io.OutputStream os) throws java.io.IOException, CmsCadesException
CadesSignatureStream(InputStream, int)
.os
- output stream to write the DER encoded CMS signature tojava.io.IOException
- if data can't be readCmsCadesException
- if signed data attributes or signed data object can't be created