|
Bouncy Castle Cryptography 1.30 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.bouncycastle.cms.CMSContentInfoParser
org.bouncycastle.cms.CMSSignedDataParser
public class CMSSignedDataParser
Parsing class for an CMS Signed Data object from an input stream.
Note: that because we are in a streaming mode only one signer can be tried and it is important that the methods on the parser are called in the appropriate order.
A simple example of usage for an encapsulated signature.
Two notes: first, in the example below the validity of the certificate isn't verified, just the fact that one of the certs matches the given signer, and, second, because we are in a streaming mode the order of the operations is important.
CMSSignedDataParser sp = new CMSSignedDataParser(encapSigData);
sp.getSignedContent().drain();
CertStore certs = sp.getCertificatesAndCRLs("Collection", "BC");
SignerInformationStore signers = sp.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();
System.out.println("verify returns: " + signer.verify(cert, "BC"));
}
| Field Summary |
|---|
| Fields inherited from class org.bouncycastle.cms.CMSContentInfoParser |
|---|
_contentInfo |
| Constructor Summary | |
|---|---|
CMSSignedDataParser(byte[] sigBlock)
|
|
CMSSignedDataParser(CMSTypedStream signedContent,
byte[] sigBlock)
|
|
CMSSignedDataParser(CMSTypedStream signedContent,
java.io.InputStream sigData)
base constructor |
|
CMSSignedDataParser(org.bouncycastle.sasn1.cms.ContentInfoParser sigData)
|
|
CMSSignedDataParser(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. |
CMSTypedStream |
getSignedContent()
|
SignerInformationStore |
getSignerInfos()
return the collection of signers that are associated with the signatures for the message. |
| Methods inherited from class org.bouncycastle.cms.CMSContentInfoParser |
|---|
readContentInfo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CMSSignedDataParser(byte[] sigBlock)
throws CMSException
CMSException
public CMSSignedDataParser(CMSTypedStream signedContent,
byte[] sigBlock)
throws CMSException
CMSException
public CMSSignedDataParser(CMSTypedStream signedContent,
java.io.InputStream sigData)
throws CMSException
signedContent - the content that was signed.sigData - the signature object.
CMSException
public CMSSignedDataParser(java.io.InputStream sigData)
throws CMSException
CMSException
public CMSSignedDataParser(org.bouncycastle.sasn1.cms.ContentInfoParser sigData)
throws CMSException
CMSException| Method Detail |
|---|
public SignerInformationStore getSignerInfos()
throws CMSException
CmsException
CMSException
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
CMSExceptionpublic CMSTypedStream getSignedContent()
|
Bouncy Castle Cryptography 1.30 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||