Bouncy Castle Cryptography Library 1.48
org.bouncycastle.mail.smime

Class SMIMEEnvelopedGenerator

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addKEKRecipient(javax.crypto.SecretKey key, byte[] keyIdentifier)
      Deprecated. 
      use addRecipientInfoGenerator()
      void addKeyAgreementRecipient(java.lang.String agreementAlgorithm, java.security.PrivateKey senderPrivateKey, java.security.PublicKey senderPublicKey, java.security.cert.X509Certificate recipientCert, java.lang.String cekWrapAlgorithm, java.security.Provider provider)
      Deprecated. 
      use addRecipientInfoGenerator()
      void addKeyAgreementRecipient(java.lang.String agreementAlgorithm, java.security.PrivateKey senderPrivateKey, java.security.PublicKey senderPublicKey, java.security.cert.X509Certificate recipientCert, java.lang.String cekWrapAlgorithm, java.lang.String provider)
      Deprecated. 
      use addRecipientInfoGenerator()
      void addKeyTransRecipient(java.security.PublicKey key, byte[] subKeyId)
      Deprecated. 
      use addRecipientInfoGenerator()
      void addKeyTransRecipient(java.security.cert.X509Certificate cert)
      Deprecated. 
      use addRecipientInfoGenerator()
      void addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen)
      add a recipientInfoGenerator.
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, org.bouncycastle.operator.OutputEncryptor encryptor)
      generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, int keySize, java.security.Provider provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, int keySize, java.lang.String provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, java.security.Provider provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content, java.lang.String encryptionOID, java.lang.String provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, org.bouncycastle.operator.OutputEncryptor encryptor)
      generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, int keySize, java.security.Provider provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, int keySize, java.lang.String provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, java.security.Provider provider)
      Deprecated.  
      javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message, java.lang.String encryptionOID, java.lang.String provider)
      Deprecated.  
      void setBerEncodeRecipients(boolean berEncodeRecipientSet)
      Use a BER Set to store the recipient information
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DES_EDE3_CBC

        public static final java.lang.String DES_EDE3_CBC
      • RC2_CBC

        public static final java.lang.String RC2_CBC
      • AES128_CBC

        public static final java.lang.String AES128_CBC
      • AES192_CBC

        public static final java.lang.String AES192_CBC
      • AES256_CBC

        public static final java.lang.String AES256_CBC
      • CAMELLIA128_CBC

        public static final java.lang.String CAMELLIA128_CBC
      • CAMELLIA192_CBC

        public static final java.lang.String CAMELLIA192_CBC
      • CAMELLIA256_CBC

        public static final java.lang.String CAMELLIA256_CBC
      • SEED_CBC

        public static final java.lang.String SEED_CBC
      • DES_EDE3_WRAP

        public static final java.lang.String DES_EDE3_WRAP
      • AES128_WRAP

        public static final java.lang.String AES128_WRAP
      • AES256_WRAP

        public static final java.lang.String AES256_WRAP
      • CAMELLIA128_WRAP

        public static final java.lang.String CAMELLIA128_WRAP
      • CAMELLIA192_WRAP

        public static final java.lang.String CAMELLIA192_WRAP
      • CAMELLIA256_WRAP

        public static final java.lang.String CAMELLIA256_WRAP
      • SEED_WRAP

        public static final java.lang.String SEED_WRAP
      • ECDH_SHA1KDF

        public static final java.lang.String ECDH_SHA1KDF
    • Constructor Detail

      • SMIMEEnvelopedGenerator

        public SMIMEEnvelopedGenerator()
        base constructor
    • Method Detail

      • addRecipientInfoGenerator

        public void addRecipientInfoGenerator(org.bouncycastle.cms.RecipientInfoGenerator recipientInfoGen)
                                       throws java.lang.IllegalArgumentException
        add a recipientInfoGenerator.
        Throws:
        java.lang.IllegalArgumentException
      • addKeyTransRecipient

        public void addKeyTransRecipient(java.security.cert.X509Certificate cert)
                                  throws java.lang.IllegalArgumentException
        Deprecated. use addRecipientInfoGenerator()
        add a recipient.
        Throws:
        java.lang.IllegalArgumentException
      • addKeyTransRecipient

        public void addKeyTransRecipient(java.security.PublicKey key,
                                byte[] subKeyId)
                                  throws java.lang.IllegalArgumentException
        Deprecated. use addRecipientInfoGenerator()
        add a recipient - note: this will only work on V3 and later clients.
        Parameters:
        key - the recipient's public key
        subKeyId - the subject key id for the recipient's public key
        Throws:
        java.lang.IllegalArgumentException
      • addKEKRecipient

        public void addKEKRecipient(javax.crypto.SecretKey key,
                           byte[] keyIdentifier)
                             throws java.lang.IllegalArgumentException
        Deprecated. use addRecipientInfoGenerator()
        add a KEK recipient.
        Throws:
        java.lang.IllegalArgumentException
      • addKeyAgreementRecipient

        public void addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
                                    java.security.PrivateKey senderPrivateKey,
                                    java.security.PublicKey senderPublicKey,
                                    java.security.cert.X509Certificate recipientCert,
                                    java.lang.String cekWrapAlgorithm,
                                    java.lang.String provider)
                                      throws java.security.NoSuchProviderException,
                                             java.security.NoSuchAlgorithmException,
                                             java.security.InvalidKeyException
        Deprecated. use addRecipientInfoGenerator()
        Add a key agreement based recipient.
        Parameters:
        senderPrivateKey - private key to initialise sender side of agreement with.
        senderPublicKey - sender public key to include with message.
        recipientCert - recipient's public key certificate.
        cekWrapAlgorithm - OID for key wrapping algorithm to use.
        provider - provider to use for the agreement calculation.
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
        java.security.InvalidKeyException
      • addKeyAgreementRecipient

        public void addKeyAgreementRecipient(java.lang.String agreementAlgorithm,
                                    java.security.PrivateKey senderPrivateKey,
                                    java.security.PublicKey senderPublicKey,
                                    java.security.cert.X509Certificate recipientCert,
                                    java.lang.String cekWrapAlgorithm,
                                    java.security.Provider provider)
                                      throws java.security.NoSuchProviderException,
                                             java.security.NoSuchAlgorithmException,
                                             java.security.InvalidKeyException
        Deprecated. use addRecipientInfoGenerator()
        Add a key agreement based recipient.
        Parameters:
        senderPrivateKey - private key to initialise sender side of agreement with.
        senderPublicKey - sender public key to include with message.
        recipientCert - recipient's public key certificate.
        cekWrapAlgorithm - OID for key wrapping algorithm to use.
        provider - provider to use for the agreement calculation.
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
        java.security.InvalidKeyException
      • setBerEncodeRecipients

        public void setBerEncodeRecipients(boolean berEncodeRecipientSet)
        Use a BER Set to store the recipient information
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                org.bouncycastle.operator.OutputEncryptor encryptor)
                                                  throws SMIMEException
        generate an enveloped object that contains an SMIME Enveloped object using the given content encryptor
        Throws:
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                org.bouncycastle.operator.OutputEncryptor encryptor)
                                                  throws SMIMEException
        generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message
        Throws:
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                java.lang.String encryptionOID,
                                                java.lang.String provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider.
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                java.lang.String encryptionOID,
                                                java.security.Provider provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider.
        Throws:
        java.security.NoSuchAlgorithmException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                java.lang.String encryptionOID,
                                                java.lang.String provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                java.lang.String encryptionOID,
                                                java.security.Provider provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                java.lang.String encryptionOID,
                                                int keySize,
                                                java.lang.String provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider. The size of the encryption key is determined by keysize.
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeBodyPart content,
                                                java.lang.String encryptionOID,
                                                int keySize,
                                                java.security.Provider provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider. The size of the encryption key is determined by keysize.
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                java.lang.String encryptionOID,
                                                int keySize,
                                                java.lang.String provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         java.security.NoSuchProviderException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message. The size of the encryption key used to protect the message is determined by keysize.
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        SMIMEException
      • generate

        public javax.mail.internet.MimeBodyPart generate(javax.mail.internet.MimeMessage message,
                                                java.lang.String encryptionOID,
                                                int keySize,
                                                java.security.Provider provider)
                                                  throws java.security.NoSuchAlgorithmException,
                                                         SMIMEException
        Deprecated. 
        generate an enveloped object that contains an SMIME Enveloped object using the given provider from the contents of the passed in message. The size of the encryption key used to protect the message is determined by keysize.
        Throws:
        java.security.NoSuchAlgorithmException
        SMIMEException
Bouncy Castle Cryptography Library 1.48