|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.javasign.operators.CMSSignedData
general class for handling a pkcs7-signature message. A simple example of usage - note, in the example below the validity of the certificate isn't verified, just the fact that one of the certs matches the given signer...
CertStore certs = s.getCertificatesAndCRLs("Collection", "BC"); SignerInformationStore signers = s.getSignerInfos(); Collection c = signers.getSigners(); Iterator it = c.iterator(); while (it.hasNext()) { SignerInformation signer = (SignerInformation)it.next(); Collection certCollection = certs.getCertificates(signer.getSID()); Iterator certIt = certCollection.iterator(); X509Certificate cert = (X509Certificate)certIt.next(); if (signer.verify(cert.getPublicKey())) { verified++; } } modified by raffa to manage tsr signatures
Constructor Summary | |
CMSSignedData(byte[] sigBlock)
|
|
CMSSignedData(CMSProcessable signedContent,
byte[] sigBlock)
|
|
CMSSignedData(CMSProcessable signedContent,
java.io.InputStream sigData)
base constructor |
|
CMSSignedData(java.io.File sigBlock)
|
|
CMSSignedData(java.io.InputStream sigData)
base constructor - with encapsulated content |
Method Summary | |
java.security.cert.CertStore |
getCertificatesAndCRLs(java.lang.String type,
java.lang.String provider)
return a CertStore containing the certificates and CRLs associated with this message. |
byte[] |
getEncoded()
return the ASN.1 encoded representation of this object. |
CMSProcessable |
getSignedContent()
|
java.lang.String |
getSignedContentTypeOID()
Return the a string representation of the OID associated with the encapsulated content info structure carried in the signed data. |
SignerInformationStore |
getSignerInfos()
return the collection of signers that are associated with the signatures for the message. |
static CMSSignedData |
replaceCertificatesAndCRLs(CMSSignedData signedData,
java.security.cert.CertStore certsAndCrls)
Replace the certificate and CRL information associated with this CMSSignedData object with the new one passed in. |
static CMSSignedData |
replaceSigners(CMSSignedData signedData,
SignerInformationStore signerInformationStore)
Replace the signerinformation store associated with this CMSSignedData object with the new one passed in. |
void |
saveEncodedStream(java.io.File out)
saves the ASN.1 encoded representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CMSSignedData(byte[] sigBlock) throws CMSException
public CMSSignedData(java.io.File sigBlock) throws CMSException, java.io.FileNotFoundException
public CMSSignedData(CMSProcessable signedContent, byte[] sigBlock) throws CMSException
public CMSSignedData(CMSProcessable signedContent, java.io.InputStream sigData) throws CMSException
signedContent
- the content that was signed.sigData
- the signature object.public CMSSignedData(java.io.InputStream sigData) throws CMSException
Method Detail |
public SignerInformationStore getSignerInfos()
public java.security.cert.CertStore getCertificatesAndCRLs(java.lang.String type, java.lang.String provider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
NoProviderException
- if the provider requested isn't available.
java.security.NoSuchAlgorithmException
- if the cert store isn't available.
java.security.NoSuchProviderException
CMSException
public java.lang.String getSignedContentTypeOID()
public CMSProcessable getSignedContent()
public byte[] getEncoded() throws java.io.IOException
java.io.IOException
public void saveEncodedStream(java.io.File out) throws java.io.IOException
java.io.IOException
public static CMSSignedData replaceSigners(CMSSignedData signedData, SignerInformationStore signerInformationStore)
signedData
- the signed data object to be used as a base.signerInformationStore
- the new signer information store to use.
public static CMSSignedData replaceCertificatesAndCRLs(CMSSignedData signedData, java.security.cert.CertStore certsAndCrls) throws CMSException
signedData
- the signed data object to be used as a base.certsAndCrls
- the new certificates and CRLs to be used.
CMSException
- if there is an error processing the CertStore
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |