Class PublicKeyEncryptionService

  • All Implemented Interfaces:
    Iterator<CipherVersion>, CipherVersionGenerator<CipherVersion>, EncryptionService, org.refcodes.generator.Generator<CipherVersion>


    public class PublicKeyEncryptionService
    extends AbstractEncryptionService
    This Encryption-Service uses a public key for an asymmetric encryption algorithm in order to encrypt any ciphers being generated before them ciphers are passed to the Encryption-Server which persists them cipher versions with the cipher UID and the encrypted cipher. A decryption server may retrieve the cipher versions with the cipher UID and the encrypted cipher and pass it to a Decryption-Service which might decrypt the ciphers with an according private key.
    • Constructor Detail

      • PublicKeyEncryptionService

        public PublicKeyEncryptionService​(String aNamespace,
                                          String aPublicKeyPath,
                                          EncryptionServer aEncryptionServer)
                                   throws edu.vt.middleware.crypt.CryptException,
                                          IOException,
                                          GeneralSecurityException
        Constructs the service with the required services and configuration.
        Parameters:
        aNamespace - The name space to which this service belongs
        aPublicKeyPath - The path on the file system to the public key to be used for encrypting any ciphers passed to the Encryption-Server for persisting.
        aEncryptionServer - The server to which the service is being "connected"
        Throws:
        edu.vt.middleware.crypt.CryptException - in case a crypt exception occurred when instantiating the public key
        IOException - in case reading the file public key caused IO problems
        GeneralSecurityException - in case a security poroblem was encountered.
      • PublicKeyEncryptionService

        public PublicKeyEncryptionService​(String aNamespace,
                                          String aPublicKeyPath,
                                          EncryptionServer aEncryptionServer,
                                          CipherVersionGenerator<CipherVersion> aCipherVersionGenerator)
                                   throws edu.vt.middleware.crypt.CryptException,
                                          IOException,
                                          GeneralSecurityException
        Constructs the service with the required services and configuration.
        Parameters:
        aNamespace - The name space to which this service belongs
        aPublicKeyPath - The path on the file system to the public key to be used for encrypting any ciphers passed to the Encryption-Server for persisting.
        aEncryptionServer - The server to which the service is being "connected"
        aCipherVersionGenerator - The generator to be used for generating CipherVersion instances.
        Throws:
        edu.vt.middleware.crypt.CryptException - in case a crypt exception occurred when instantiating the public key
        IOException - in case reading the file public key caused IO problems
        GeneralSecurityException - in case a security poroblem was encountered.
      • PublicKeyEncryptionService

        public PublicKeyEncryptionService​(String aNamespace,
                                          String aPublicKeyPath,
                                          EncryptionServer aEncryptionServer,
                                          CipherVersionFactory<CipherVersion> aCipherVersionFactory)
                                   throws edu.vt.middleware.crypt.CryptException,
                                          IOException,
                                          GeneralSecurityException
        Constructs the service with the required services and configuration.
        Parameters:
        aNamespace - The name space to which this service belongs
        aPublicKeyPath - The path on the file system to the public key to be used for encrypting any ciphers passed to the Encryption-Server for persisting.
        aEncryptionServer - The server to which the service is being "connected"
        aCipherVersionFactory - The factory to be used for creating CipherVersion instances.
        Throws:
        edu.vt.middleware.crypt.CryptException - in case a crypt exception occurred when instantiating the public key
        IOException - in case reading the file public key caused IO problems
        GeneralSecurityException - in case a security poroblem was encountered.
      • PublicKeyEncryptionService

        public PublicKeyEncryptionService​(String aNamespace,
                                          String aPublicKeyPath,
                                          EncryptionServer aEncryptionServer,
                                          CipherVersionGenerator<CipherVersion> aCipherVersionGenerator,
                                          CipherVersionFactory<CipherVersion> aCipherVersionFactory)
                                   throws GeneralSecurityException,
                                          edu.vt.middleware.crypt.CryptException,
                                          IOException
        Constructs the service with the required services and configuration.
        Parameters:
        aNamespace - The name space to which this service belongs
        aPublicKeyPath - The path on the file system to the public key to be used for encrypting any ciphers passed to the Encryption-Server for persisting.
        aEncryptionServer - The server to which the service is being "connected"
        aCipherVersionGenerator - The generator to be used for generating CipherVersion instances.
        aCipherVersionFactory - The factory to be used for creating CipherVersion instances.
        Throws:
        edu.vt.middleware.crypt.CryptException - in case a crypt exception occurred when instantiating the public key
        IOException - in case reading the file public key caused IO problems
        GeneralSecurityException - in case a security poroblem was encountered.
    • Method Detail

      • toEncryptedCipherVersion

        protected <CV extends CipherVersion> CV toEncryptedCipherVersion​(CV aDecryptedCipherVersion)
        To encrypted cipher version.
        Specified by:
        toEncryptedCipherVersion in class AbstractEncryptionService
        Type Parameters:
        CV - the generic type
        Parameters:
        aDecryptedCipherVersion - the decrypted cipher version
        Returns:
        the cv