Module org.refcodes.forwardsecrecy
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>
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
ConstructorDescriptionPublicKeyEncryptionService
(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
Modifier and TypeMethodDescriptionprotected <CV extends CipherVersion>
CVtoEncryptedCipherVersion
(CV aDecryptedCipherVersion) To encrypted cipher version.Methods inherited from class org.refcodes.forwardsecrecy.AbstractEncryptionService
hasNext, next, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
PublicKeyEncryptionService
public PublicKeyEncryptionService(String aNamespace, String aPublicKeyPath, EncryptionServer aEncryptionServer) throws 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:
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 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:
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 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:
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, 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:
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 Details
-
toEncryptedCipherVersion
To encrypted cipher version.- Specified by:
toEncryptedCipherVersion
in classAbstractEncryptionService
- Type Parameters:
CV
- the generic type- Parameters:
aDecryptedCipherVersion
- the decrypted cipher version- Returns:
- the cv
-