Bouncy Castle Cryptography Library 1.44

org.bouncycastle.cms
Class SignerInformation

java.lang.Object
  extended by org.bouncycastle.cms.SignerInformation

public class SignerInformation
extends java.lang.Object

an expanded SignerInfo block from a CMS Signed message


Method Summary
static SignerInformation addCounterSigners(SignerInformation signerInformation, SignerInformationStore counterSigners)
          Return a signer information object with passed in SignerInformationStore representing counter signatures attached as an unsigned attribute.
 byte[] getContentDigest()
          return the content digest that was calculated during verification.
 SignerInformationStore getCounterSignatures()
          Return a SignerInformationStore containing the counter signatures attached to this signer.
 java.lang.String getDigestAlgOID()
          return the object identifier for the signature.
 org.bouncycastle.asn1.x509.AlgorithmIdentifier getDigestAlgorithmID()
           
 byte[] getDigestAlgParams()
          return the signature parameters, or null if there aren't any.
 byte[] getEncodedSignedAttributes()
          return the DER encoding of the signed attributes.
 java.lang.String getEncryptionAlgOID()
          return the object identifier for the signature.
 byte[] getEncryptionAlgParams()
          return the signature/encryption algorithm parameters, or null if there aren't any.
 SignerId getSID()
           
 byte[] getSignature()
          return the encoded signature
 org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()
          return a table of the signed attributes - indexed by the OID of the attribute.
 org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()
          return a table of the unsigned attributes indexed by the OID of the attribute.
 int getVersion()
          return the version number for this objects underlying SignerInfo structure.
static SignerInformation replaceUnsignedAttributes(SignerInformation signerInformation, org.bouncycastle.asn1.cms.AttributeTable unsignedAttributes)
          Return a signer information object with the passed in unsigned attributes replacing the ones that are current associated with the object passed in.
 org.bouncycastle.asn1.cms.SignerInfo toSignerInfo()
          Return the base ASN.1 CMS structure that this object contains.
 boolean verify(java.security.PublicKey key, java.security.Provider sigProvider)
          verify that the given public key successfully handles and confirms the signature associated with this signer.
 boolean verify(java.security.PublicKey key, java.lang.String sigProvider)
          verify that the given public key successfully handles and confirms the signature associated with this signer.
 boolean verify(java.security.cert.X509Certificate cert, java.security.Provider sigProvider)
          verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated.
 boolean verify(java.security.cert.X509Certificate cert, java.lang.String sigProvider)
          verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSID

public SignerId getSID()

getVersion

public int getVersion()
return the version number for this objects underlying SignerInfo structure.


getDigestAlgorithmID

public org.bouncycastle.asn1.x509.AlgorithmIdentifier getDigestAlgorithmID()

getDigestAlgOID

public java.lang.String getDigestAlgOID()
return the object identifier for the signature.


getDigestAlgParams

public byte[] getDigestAlgParams()
return the signature parameters, or null if there aren't any.


getContentDigest

public byte[] getContentDigest()
return the content digest that was calculated during verification.


getEncryptionAlgOID

public java.lang.String getEncryptionAlgOID()
return the object identifier for the signature.


getEncryptionAlgParams

public byte[] getEncryptionAlgParams()
return the signature/encryption algorithm parameters, or null if there aren't any.


getSignedAttributes

public org.bouncycastle.asn1.cms.AttributeTable getSignedAttributes()
return a table of the signed attributes - indexed by the OID of the attribute.


getUnsignedAttributes

public org.bouncycastle.asn1.cms.AttributeTable getUnsignedAttributes()
return a table of the unsigned attributes indexed by the OID of the attribute.


getSignature

public byte[] getSignature()
return the encoded signature


getCounterSignatures

public SignerInformationStore getCounterSignatures()
Return a SignerInformationStore containing the counter signatures attached to this signer. If no counter signatures are present an empty store is returned.


getEncodedSignedAttributes

public byte[] getEncodedSignedAttributes()
                                  throws java.io.IOException
return the DER encoding of the signed attributes.

Throws:
java.io.IOException - if an encoding error occurs.

verify

public boolean verify(java.security.PublicKey key,
                      java.lang.String sigProvider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      CMSException
verify that the given public key successfully handles and confirms the signature associated with this signer.

Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
CMSException

verify

public boolean verify(java.security.PublicKey key,
                      java.security.Provider sigProvider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      CMSException
verify that the given public key successfully handles and confirms the signature associated with this signer.

Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
CMSException

verify

public boolean verify(java.security.cert.X509Certificate cert,
                      java.lang.String sigProvider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      java.security.cert.CertificateExpiredException,
                      java.security.cert.CertificateNotYetValidException,
                      CMSException
verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated.

Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException
CMSException

verify

public boolean verify(java.security.cert.X509Certificate cert,
                      java.security.Provider sigProvider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.cert.CertificateExpiredException,
                      java.security.cert.CertificateNotYetValidException,
                      CMSException
verify that the given certificate successfully handles and confirms the signature associated with this signer and, if a signingTime attribute is available, that the certificate was valid at the time the signature was generated.

Throws:
java.security.NoSuchAlgorithmException
java.security.cert.CertificateExpiredException
java.security.cert.CertificateNotYetValidException
CMSException

toSignerInfo

public org.bouncycastle.asn1.cms.SignerInfo toSignerInfo()
Return the base ASN.1 CMS structure that this object contains.

Returns:
an object containing a CMS SignerInfo structure.

replaceUnsignedAttributes

public static SignerInformation replaceUnsignedAttributes(SignerInformation signerInformation,
                                                          org.bouncycastle.asn1.cms.AttributeTable unsignedAttributes)
Return a signer information object with the passed in unsigned attributes replacing the ones that are current associated with the object passed in.

Parameters:
signerInformation - the signerInfo to be used as the basis.
unsignedAttributes - the unsigned attributes to add.
Returns:
a copy of the original SignerInformationObject with the changed attributes.

addCounterSigners

public static SignerInformation addCounterSigners(SignerInformation signerInformation,
                                                  SignerInformationStore counterSigners)
Return a signer information object with passed in SignerInformationStore representing counter signatures attached as an unsigned attribute.

Parameters:
signerInformation - the signerInfo to be used as the basis.
counterSigners - signer info objects carrying counter signature.
Returns:
a copy of the original SignerInformationObject with the changed attributes.

Bouncy Castle Cryptography Library 1.44