public class BaseSignedData
extends java.lang.Object
This class provides you to create signed documents and to parse the signed documents.
This class encapsulates SignedData
The message digest algorithms for all the signers and the SignerInfo values for all the signers are collected together with the content into a SignedData value.
| Modifier and Type | Field and Description |
|---|---|
protected static int[] |
DEFAULT_CONTENT_TYPE |
| Constructor and Description |
|---|
BaseSignedData()
Creates new empty BaseSignedData
|
BaseSignedData(byte[] aContentInfo)
Creates BaseSignedData from given ContentInfo
|
BaseSignedData(tr.gov.tubitak.uekae.esya.api.asn.cms.EContentInfo aContentInfo)
Creates BaseSignedData from given ContentInfo
|
BaseSignedData(tr.gov.tubitak.uekae.esya.api.asn.cms.ESignedData aSignedData)
Creates BaseSignedData from given SignedData
|
BaseSignedData(java.io.InputStream aContentInfo)
Creates BaseSignedData from given ContentInfo.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addContent(ISignable aContent)
Adds the content that will be signed to BaseSignedData.By default, type of content is id_data (1.2.840.113549.1.7.1).
|
void |
addContent(ISignable aContent,
boolean aIsContentIncluded)
Adds the content that will be signed to BaseSignedData.
|
void |
addContent(ISignable aContent,
int[] aContentType,
boolean aIsContentIncluded)
Adds the content that will be signed to BaseSignedData
|
void |
addSigner(ESignatureType aType,
tr.gov.tubitak.uekae.esya.api.asn.x509.ECertificate aCer,
tr.gov.tubitak.uekae.esya.api.common.crypto.BaseSigner aSignerInterface,
java.util.List<IAttribute> aOptionalAttributes,
java.util.Map<java.lang.String,java.lang.Object> aParameters)
Adds signer to BaseSignedData
|
void |
attachExternalContent(ISignable aContent)
Adds the signed content to the signature
|
boolean |
checkIfAnyESAv2Exist()
Checks whether one of the signer is ESA with archive timestamp v2
|
void |
detachContent()
Removes the signed content from the signature
|
java.util.List<Signer> |
getAllSigners()
Returns all the signers in BaseSignedData
|
byte[] |
getContent()
Returns content of EncapsulatedContentInfo of SignedData,that is content being signed.
|
protected tr.gov.tubitak.uekae.esya.api.asn.cms.EContentInfo |
getContentInfo()
Returns the ContentInfo that wraps BaseSignedData
|
byte[] |
getEncoded()
Returns the encoded value of the ContentInfo that wraps BaseSignedData
|
tr.gov.tubitak.uekae.esya.api.asn.cms.ESignedData |
getSignedData()
Returns the SignedData of BaseSignedData
|
java.util.List<Signer> |
getSignerList()
Returns the signers in BaseSignedData
|
boolean |
isExternalContent()
Checks whether content is external or not.
|
static boolean |
isSigned(java.io.InputStream aInputStream)
Checks whether data is signed or not.
|
boolean |
removeSigner(tr.gov.tubitak.uekae.esya.api.asn.cms.ESignerInfo aSignerInfo)
Removes a signer from BaseSignedData
|
public BaseSignedData()
public BaseSignedData(tr.gov.tubitak.uekae.esya.api.asn.cms.EContentInfo aContentInfo)
throws NotSignedDataException,
CMSSignatureException
aContentInfo - NotSignedDataException - If it is not a signed data.CMSSignatureException - Asn1 decode error.public BaseSignedData(tr.gov.tubitak.uekae.esya.api.asn.cms.ESignedData aSignedData)
public BaseSignedData(byte[] aContentInfo)
throws NotSignedDataException,
CMSSignatureException
aContentInfo - NotSignedDataException - If it is not a signed data.CMSSignatureException - In Asn1 decode error.public BaseSignedData(java.io.InputStream aContentInfo)
throws NotSignedDataException,
CMSSignatureException
aContentInfo - NotSignedDataException - If it is not a signed data.CMSSignatureException - In Asn1 decode error.public void addContent(ISignable aContent, int[] aContentType, boolean aIsContentIncluded) throws CMSSignatureException
aContent - Content that will be signedaContentType - Type of content that will be signedaIsContentIncluded - Specifies if content should be in SignedData structureCMSSignatureExceptionpublic void addContent(ISignable aContent, boolean aIsContentIncluded) throws CMSSignatureException
aContent - Content that will be signedaIsContentIncluded - Specifies if content should be in SignedData structureCMSSignatureExceptionpublic void attachExternalContent(ISignable aContent) throws CMSSignatureException
aContent - Content that was signedCMSSignatureExceptionpublic void detachContent()
public void addContent(ISignable aContent) throws CMSSignatureException
aContent - Content that will be signedCMSSignatureExceptionpublic static boolean isSigned(java.io.InputStream aInputStream)
throws java.io.IOException
java.io.IOExceptionpublic boolean removeSigner(tr.gov.tubitak.uekae.esya.api.asn.cms.ESignerInfo aSignerInfo)
aSignerInfo - ESignerInfo which will be removedpublic void addSigner(ESignatureType aType, tr.gov.tubitak.uekae.esya.api.asn.x509.ECertificate aCer, tr.gov.tubitak.uekae.esya.api.common.crypto.BaseSigner aSignerInterface, java.util.List<IAttribute> aOptionalAttributes, java.util.Map<java.lang.String,java.lang.Object> aParameters) throws CMSSignatureException
aType - Type of signature that this signer will haveaCer - Signer's certificateaSignerInterface - The signature of the signer will be generated with this interfaceaOptionalAttributes - The optional signed attributes that will be addedaParameters - Parameters necessary for signature generation of the given type and for optional attributesCMSSignatureException - When certificate validation failspublic tr.gov.tubitak.uekae.esya.api.asn.cms.ESignedData getSignedData()
public byte[] getEncoded()
protected tr.gov.tubitak.uekae.esya.api.asn.cms.EContentInfo getContentInfo()
public byte[] getContent()
public boolean isExternalContent()
throws CMSSignatureException
CMSSignatureExceptionpublic java.util.List<Signer> getSignerList() throws CMSSignatureException
CMSSignatureExceptionpublic java.util.List<Signer> getAllSigners() throws CMSSignatureException
CMSSignatureExceptionpublic boolean checkIfAnyESAv2Exist()
throws CMSSignatureException
CMSSignatureExceptionCopyright © 2025. All rights reserved.