Package org.refcodes.forwardsecrecy
Class PublicKeyEncryptionService
- java.lang.Object
-
- org.refcodes.forwardsecrecy.AbstractEncryptionService
-
- org.refcodes.forwardsecrecy.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 Summary
Constructors Constructor Description PublicKeyEncryptionService(String aNamespace, String aPublicKeyPath, EncryptionServer aEncryptionServer)
Constructs the service with the required services and configuration.PublicKeyEncryptionService(String aNamespace, String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory)
Constructs the service with the required services and configuration.PublicKeyEncryptionService(String aNamespace, String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator)
Constructs the service with the required services and configuration.PublicKeyEncryptionService(String aNamespace, String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator, CipherVersionFactory<CipherVersion> aCipherVersionFactory)
Constructs the service with the required services and configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <CV extends CipherVersion>
CVtoEncryptedCipherVersion(CV aDecryptedCipherVersion)
To encrypted cipher version.-
Methods inherited from class org.refcodes.forwardsecrecy.AbstractEncryptionService
hasNext, next, remove
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
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 belongsaPublicKeyPath
- 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 keyIOException
- in case reading the file public key caused IO problemsGeneralSecurityException
- 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 belongsaPublicKeyPath
- 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 generatingCipherVersion
instances.- Throws:
edu.vt.middleware.crypt.CryptException
- in case a crypt exception occurred when instantiating the public keyIOException
- in case reading the file public key caused IO problemsGeneralSecurityException
- 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 belongsaPublicKeyPath
- 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 creatingCipherVersion
instances.- Throws:
edu.vt.middleware.crypt.CryptException
- in case a crypt exception occurred when instantiating the public keyIOException
- in case reading the file public key caused IO problemsGeneralSecurityException
- 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 belongsaPublicKeyPath
- 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 generatingCipherVersion
instances.aCipherVersionFactory
- The factory to be used for creatingCipherVersion
instances.- Throws:
edu.vt.middleware.crypt.CryptException
- in case a crypt exception occurred when instantiating the public keyIOException
- in case reading the file public key caused IO problemsGeneralSecurityException
- 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 classAbstractEncryptionService
- Type Parameters:
CV
- the generic type- Parameters:
aDecryptedCipherVersion
- the decrypted cipher version- Returns:
- the cv
-
-