Package org.refcodes.forwardsecrecy
Class PublicKeyEncryptionServiceImpl
- java.lang.Object
-
- org.refcodes.forwardsecrecy.AbstractEncryptionService
-
- org.refcodes.forwardsecrecy.PublicKeyEncryptionServiceImpl
-
- All Implemented Interfaces:
java.util.Iterator<CipherVersion>
,CipherVersionGenerator<CipherVersion>
,EncryptionService
,org.refcodes.generator.Generator<CipherVersion>
public class PublicKeyEncryptionServiceImpl 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 PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer)
Constructs the service with the required services and configuration.PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory)
Constructs the service with the required services and configuration.PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator)
Constructs the service with the required services and configuration.PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.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
-
-
-
-
Constructor Detail
-
PublicKeyEncryptionServiceImpl
public PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer) throws edu.vt.middleware.crypt.CryptException, java.io.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"- Throws:
edu.vt.middleware.crypt.CryptException
- in case a crypt exception occurred when instantiating the public keyjava.io.IOException
- in case reading the file public key caused IO problems
-
PublicKeyEncryptionServiceImpl
public PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator) throws edu.vt.middleware.crypt.CryptException, java.io.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.- Throws:
edu.vt.middleware.crypt.CryptException
- in case a crypt exception occurred when instantiating the public keyjava.io.IOException
- in case reading the file public key caused IO problems
-
PublicKeyEncryptionServiceImpl
public PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory) throws edu.vt.middleware.crypt.CryptException, java.io.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"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 keyjava.io.IOException
- in case reading the file public key caused IO problems
-
PublicKeyEncryptionServiceImpl
public PublicKeyEncryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPublicKeyPath, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator, CipherVersionFactory<CipherVersion> aCipherVersionFactory) throws edu.vt.middleware.crypt.CryptException, java.io.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 keyjava.io.IOException
- in case reading the file public key caused IO problems
-
-
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
-
-