Class SMimePackageEncryptor

    • Constructor Detail

      • SMimePackageEncryptor

        public SMimePackageEncryptor​(String location,
                                     String password,
                                     String aliasOrCN)
        Create new instance for work with S/MIME mails using specified key store and alias
        Parameters:
        location - the location (path and filename) of the file containing the keystore/certificate (chain)
        password - the password to access the given keystore or 'null' if there is no password
        aliasOrCN - the key pair alias or a CN (Common Name) if there is no private key
      • SMimePackageEncryptor

        public SMimePackageEncryptor​(String location,
                                     String password)
        Create new instance for work with S/MIME mails using specified key store.
        This constructor is used when the key alias is not known and all the keys in the keystore will be tried for decryption and checking the signature. For the methods which require key alias, like encryption and signing, exception will be thrown
        Parameters:
        location - the location (path and filename) of the file containing the keystore
        password - the password to access the given keystore
      • SMimePackageEncryptor

        public SMimePackageEncryptor​(List<String> locations,
                                     List<String> passwords,
                                     List<String> aliasOrCNs)
                              throws ActionException
        Create new instance for work with S/MIME mails using specified key stores and aliases.
        This constructor should be used when sending a mail to more than one recipient. A list of certificates is passed, so the symmetric key(used to encrypt the mail) will be encrypted many times(once per certificate). This way each recipient will be able to decrypt the mail using his own certificate.
        Parameters:
        locations - the locations (path and filename) of the files containing the keystore/certificate (chain)
        passwords - the passwords to access the given keystores or 'null' if there is no password
        aliasOrCNs - the key pair aliases or CNs (Common Name) if there is no private key
        Throws:
        ActionException