public class CMSSignedData
extends java.lang.Object
CertStore certs = s.getCertificatesAndCRLs("Collection", GammaTechProvider.PROVIDER_NAME); 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++; } }
Modifier and Type | Field and Description |
---|---|
(package private) X509Store |
attributeStore |
(package private) X509Store |
certificateStore |
(package private) java.security.cert.CertStore |
certStore |
(package private) ContentInfo |
contentInfo |
(package private) X509Store |
crlStore |
private java.util.Map |
hashes |
private static CMSSignedHelper |
HELPER |
(package private) CMSProcessable |
signedContent |
(package private) SignedData |
signedData |
(package private) SignerInformationStore |
signerInfoStore |
Modifier | Constructor and Description |
---|---|
|
CMSSignedData(byte[] sigBlock) |
|
CMSSignedData(CMSProcessable signedContent,
byte[] sigBlock) |
|
CMSSignedData(CMSProcessable signedContent,
ContentInfo sigData) |
|
CMSSignedData(CMSProcessable signedContent,
java.io.InputStream sigData)
base constructor - content with detached signature.
|
private |
CMSSignedData(CMSSignedData c) |
|
CMSSignedData(ContentInfo sigData) |
|
CMSSignedData(java.io.InputStream sigData)
base constructor - with encapsulated content
|
|
CMSSignedData(java.util.Map hashes,
byte[] sigBlock)
Content with detached signature, digests precomputed
|
|
CMSSignedData(java.util.Map hashes,
ContentInfo sigData) |
Modifier and Type | Method and Description |
---|---|
X509Store |
getAttributeCertificates(java.lang.String type,
java.lang.String provider)
return a X509Store containing the attribute certificates, if any, contained
in this message.
|
X509Store |
getCertificates(java.lang.String type,
java.lang.String provider)
return a X509Store containing the public key certificates, if any, contained
in this message.
|
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.
|
X509Store |
getCRLs(java.lang.String type,
java.lang.String provider)
return a X509Store containing CRLs, if any, contained
in 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.
|
int |
getVersion()
Return the version number for this object
|
private static AlgorithmIdentifier |
makeAlgId(java.lang.String oid,
byte[] params) |
private static DERObject |
makeObj(byte[] encoding) |
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.
|
private static CMSSignedHelper HELPER
SignedData signedData
ContentInfo contentInfo
CMSProcessable signedContent
java.security.cert.CertStore certStore
SignerInformationStore signerInfoStore
X509Store attributeStore
X509Store certificateStore
X509Store crlStore
private java.util.Map hashes
private CMSSignedData(CMSSignedData c)
public CMSSignedData(byte[] sigBlock) throws CMSException
CMSException
public CMSSignedData(CMSProcessable signedContent, byte[] sigBlock) throws CMSException
CMSException
public CMSSignedData(java.util.Map hashes, byte[] sigBlock) throws CMSException
hashes
- a map of precomputed digests for content indexed by name of hash.sigBlock
- the signature object.CMSException
public CMSSignedData(CMSProcessable signedContent, java.io.InputStream sigData) throws CMSException
signedContent
- the content that was signed.sigData
- the signature object.CMSException
public CMSSignedData(java.io.InputStream sigData) throws CMSException
CMSException
public CMSSignedData(CMSProcessable signedContent, ContentInfo sigData)
public CMSSignedData(java.util.Map hashes, ContentInfo sigData)
public CMSSignedData(ContentInfo sigData)
public int getVersion()
public SignerInformationStore getSignerInfos()
public X509Store getAttributeCertificates(java.lang.String type, java.lang.String provider) throws NoSuchStoreException, java.security.NoSuchProviderException, CMSException
type
- type of store to createprovider
- provider to usejava.security.NoSuchProviderException
- if the provider requested isn't available.NoSuchStoreException
- if the store type isn't available.CMSException
- if a general exception prevents creation of the X509Storepublic X509Store getCertificates(java.lang.String type, java.lang.String provider) throws NoSuchStoreException, java.security.NoSuchProviderException, CMSException
type
- type of store to createprovider
- provider to usejava.security.NoSuchProviderException
- if the provider requested isn't available.NoSuchStoreException
- if the store type isn't available.CMSException
- if a general exception prevents creation of the X509Storepublic X509Store getCRLs(java.lang.String type, java.lang.String provider) throws NoSuchStoreException, java.security.NoSuchProviderException, CMSException
type
- type of store to createprovider
- provider to usejava.security.NoSuchProviderException
- if the provider requested isn't available.NoSuchStoreException
- if the store type isn't available.CMSException
- if a general exception prevents creation of the X509Storepublic java.security.cert.CertStore getCertificatesAndCRLs(java.lang.String type, java.lang.String provider) throws java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, CMSException
java.security.NoSuchProviderException
- if the provider requested isn't available.java.security.NoSuchAlgorithmException
- if the cert store isn't available.CMSException
- if a general exception prevents creation of the CertStorepublic java.lang.String getSignedContentTypeOID()
public CMSProcessable getSignedContent()
public byte[] getEncoded() 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 CertStoreprivate static DERObject makeObj(byte[] encoding) throws java.io.IOException
java.io.IOException
private static AlgorithmIdentifier makeAlgId(java.lang.String oid, byte[] params) throws java.io.IOException
java.io.IOException
Copyright © 1998-2014 Gamma Technologies. All Rights Reserved.