| java.lang.Object org.bouncycastle.cms.CMSSignedData org.bouncycastle.mail.smime.SMIMESigned
SMIMESigned | public class SMIMESigned extends CMSSignedData (Code) | | 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.getCertificates("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++;
}
}
Note: if you are using this class with AS2 or some other protocol
that does not use 7bit as the default content transfer encoding you
will need to use the constructor that allows you to specify the default
content transfer encoding, such as "binary".
|
Constructor Summary | |
public | SMIMESigned(MimeMultipart message) | public | SMIMESigned(MimeMultipart message, String defaultContentTransferEncoding) | public | SMIMESigned(Part message) base constructor for a signed message with encapsulated content. |
content | MimeBodyPart content(Code) | | |
SMIMESigned | public SMIMESigned(MimeMultipart message) throws MessagingException, CMSException(Code) | | base constructor using a defaultContentTransferEncoding of 7bit
exception: MessagingException - on an error extracting the signature orotherwise processing the message. exception: CMSException - if some other problem occurs. |
SMIMESigned | public SMIMESigned(MimeMultipart message, String defaultContentTransferEncoding) throws MessagingException, CMSException(Code) | | base constructor with settable contentTransferEncoding
Parameters: message - the signed message Parameters: defaultContentTransferEncoding - new default to use exception: MessagingException - on an error extracting the signature orotherwise processing the message. exception: CMSException - if some other problem occurs. |
SMIMESigned | public SMIMESigned(Part message) throws MessagingException, CMSException, SMIMEException(Code) | | base constructor for a signed message with encapsulated content.
exception: MessagingException - on an error extracting the signature orotherwise processing the message. exception: SMIMEException - if the body part encapsulated in the message cannot be extracted. exception: CMSException - if some other problem occurs. |
getContent | public MimeBodyPart getContent()(Code) | | return the content that was signed.
|
getContentAsMimeMessage | public MimeMessage getContentAsMimeMessage(Session session) throws MessagingException, IOException(Code) | | Return the content that was signed as a mime message.
Parameters: session - a MimeMessage holding the content. throws: MessagingException - |
getContentWithSignature | public Object getContentWithSignature()(Code) | | return the content that was signed - depending on whether this was
unencapsulated or not it will return a MimeMultipart or a MimeBodyPart
|
Methods inherited from org.bouncycastle.cms.CMSSignedData | public X509Store getAttributeCertificates(String type, String provider) throws NoSuchStoreException, NoSuchProviderException, CMSException(Code)(Java Doc) public X509Store getCRLs(String type, String provider) throws NoSuchStoreException, NoSuchProviderException, CMSException(Code)(Java Doc) public X509Store getCertificates(String type, String provider) throws NoSuchStoreException, NoSuchProviderException, CMSException(Code)(Java Doc) public CertStore getCertificatesAndCRLs(String type, String provider) throws NoSuchAlgorithmException, NoSuchProviderException, CMSException(Code)(Java Doc) public byte[] getEncoded() throws IOException(Code)(Java Doc) public CMSProcessable getSignedContent()(Code)(Java Doc) public String getSignedContentTypeOID()(Code)(Java Doc) public SignerInformationStore getSignerInfos()(Code)(Java Doc) public int getVersion()(Code)(Java Doc) public static CMSSignedData replaceCertificatesAndCRLs(CMSSignedData signedData, CertStore certsAndCrls) throws CMSException(Code)(Java Doc) public static CMSSignedData replaceSigners(CMSSignedData signedData, SignerInformationStore signerInformationStore)(Code)(Java Doc)
|
|
|