Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.19
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.bouncycastle.mail.smime
Class SMIMESignedGenerator

    java.lang.Object
      |
      +--org.bouncycastle.mail.smime.SMIMEGenerator
            |
            +--org.bouncycastle.mail.smime.SMIMESignedGenerator

public class SMIMESignedGenerator
extends SMIMEGenerator

general class for generating a pkcs7-signature message.

A simple example of usage.

          CertStore           certs...
          SMIMESignedGenerator  fact = new SMIMESignedGenerator();

          fact.addSigner(privKey, cert, SMIMESignedGenerator.DIGEST_SHA1);
          fact.addCertificatesAndCRLs(certs);

          MimeMultipart       smime = fact.generate(content, "BC");

Field Summary
`static java.lang.String` | `DIGEST_MD5`
`static java.lang.String` | `DIGEST_SHA1`
`static java.lang.String` | `ENCRYPTION_DSA`
`static java.lang.String` | `ENCRYPTION_RSA`

Fields inherited from class org.bouncycastle.mail.smime.SMIMEGenerator
`encoding, useBase64`

Constructor Summary
`SMIMESignedGenerator()` base constructor

Method Summary
`void` | `addCertificatesAndCRLs(java.security.cert.CertStore certStore)` add the certificates and CRLs contained in the given CertStore to the pool that will be included in the encoded signature block.
`void` | `addSigner(java.security.PrivateKey key, java.security.cert.X509Certificate cert, java.lang.String digestOID)` add a signer - no attributes other than the default ones will be provided here.
`void` | `addSigner(java.security.PrivateKey key, java.security.cert.X509Certificate cert, java.lang.String digestOID, AttributeTable signedAttr, AttributeTable unsignedAttr)` add a signer with extra signed/unsigned attributes.
`javax.mail.internet.MimeMultipart` | `generate(javax.mail.internet.MimeBodyPart content, java.lang.String sigProvider)` generate a signed object that contains an SMIME Signed Multipart object using the given provider.
`javax.mail.internet.MimeMultipart` | `generate(javax.mail.internet.MimeMessage message, java.lang.String sigProvider)` generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage

Methods inherited from class org.bouncycastle.mail.smime.SMIMEGenerator
`makeContentBodyPart, makeContentBodyPart, setContentTransferEncoding`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DIGEST_SHA1

    public static final java.lang.String DIGEST_SHA1

See Also:
  Constant Field Values

### DIGEST_MD5

    public static final java.lang.String DIGEST_MD5

See Also:
  Constant Field Values

### ENCRYPTION_RSA

    public static final java.lang.String ENCRYPTION_RSA

See Also:
  Constant Field Values

### ENCRYPTION_DSA

    public static final java.lang.String ENCRYPTION_DSA

See Also:
  Constant Field Values

Constructor Detail

### SMIMESignedGenerator

    public SMIMESignedGenerator()

  base constructor

Method Detail

### addSigner

    public void addSigner(java.security.PrivateKey key,
                          java.security.cert.X509Certificate cert,
                          java.lang.String digestOID)
                   throws java.lang.IllegalArgumentException

  add a signer - no attributes other than the default ones will be provided here.

    `java.lang.IllegalArgumentException`

### addSigner

    public void addSigner(java.security.PrivateKey key,
                          java.security.cert.X509Certificate cert,
                          java.lang.String digestOID,
                          AttributeTable signedAttr,
                          AttributeTable unsignedAttr)
                   throws java.lang.IllegalArgumentException

  add a signer with extra signed/unsigned attributes.

    `java.lang.IllegalArgumentException`

### addCertificatesAndCRLs

    public void addCertificatesAndCRLs(java.security.cert.CertStore certStore)
                                throws java.security.cert.CertStoreException,
                                       SMIMEException

  add the certificates and CRLs contained in the given CertStore to the pool that will be included in the encoded signature block.

  Note: this assumes the CertStore will support null in the get methods.

    `java.security.cert.CertStoreException`
    `SMIMEException`

### generate

    public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeBodyPart content,
                                                      java.lang.String sigProvider)
                                               throws java.security.NoSuchAlgorithmException,
                                                      java.security.NoSuchProviderException,
                                                      SMIMEException

  generate a signed object that contains an SMIME Signed Multipart object using the given provider.

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

### generate

    public javax.mail.internet.MimeMultipart generate(javax.mail.internet.MimeMessage message,
                                                      java.lang.String sigProvider)
                                               throws java.security.NoSuchAlgorithmException,
                                                      java.security.NoSuchProviderException,
                                                      SMIMEException

  generate a signed object that contains an SMIME Signed Multipart object using the given provider from the given MimeMessage

    `java.security.NoSuchAlgorithmException`
    `java.security.NoSuchProviderException`
    `SMIMEException`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Bouncy Castle Cryptography 1.19
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD