Package org.refcodes.forwardsecrecy
Class PublicKeyDecryptionServiceImpl
- java.lang.Object
-
- org.refcodes.forwardsecrecy.AbstractDecryptionService
-
- org.refcodes.forwardsecrecy.PublicKeyDecryptionServiceImpl
-
- All Implemented Interfaces:
DecryptionService
public class PublicKeyDecryptionServiceImpl extends AbstractDecryptionService
TheDecryptionService
retrievesCipherVersion
instances from theDecryptionServer
and is decrypting the ciphers contained in theCipherVersion
instances with a private key.
-
-
Constructor Summary
Constructors Constructor Description PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, java.lang.String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer)
Constructs the service with the required services and configuration.PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, java.lang.String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory)
Constructs the service with the required services and configuration.PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, DecryptionServer aDecryptionServer)
Constructs the service with the required services and configuration.PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, DecryptionServer aDecryptionServer, 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 java.lang.String
createMessage()
Creates a message for which a signature is to be created in order to authenticate for the retrieval of the cipher versions.protected <CV extends CipherVersion>
CVtoDecryptedCipherVersion(CV aEncyrptedCipherVersion)
To decrypted cipher version.protected java.lang.String
toSignature(java.lang.String aMessage)
Creates a signature for the given message.-
Methods inherited from class org.refcodes.forwardsecrecy.AbstractDecryptionService
getCipherVersions, setCipherVersionsExpireTimeInMs
-
-
-
-
Constructor Detail
-
PublicKeyDecryptionServiceImpl
public PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory) throws edu.vt.middleware.crypt.CryptException, java.io.IOException
Constructs the service with the required services and configuration.- Parameters:
aPrivateKeyPath
- The path on the file system to the private key to be used for decrypting any ciphers passed by the decryption server in CipherVersions retrieved from a storage.aDecryptionServer
- The decryption server for accessing the cipher versionsaCipherVersionFactory
- The factory to be used for creatingCipherVersion
instances.- Throws:
java.io.IOException
- in case of I/O problemsedu.vt.middleware.crypt.CryptException
- in case the cryptography algorithm had problems.
-
PublicKeyDecryptionServiceImpl
public PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, DecryptionServer aDecryptionServer) throws edu.vt.middleware.crypt.CryptException, java.io.IOException
Constructs the service with the required services and configuration.- Parameters:
aPrivateKeyPath
- The path on the file system to the private key to be used for decrypting any ciphers passed by the decryption server in CipherVersions retrieved from a storage.aDecryptionServer
- The decryption server for accessing the cipher versions- Throws:
java.io.IOException
- in case of I/O problemsedu.vt.middleware.crypt.CryptException
- in case the cryptography algorithm had problems.
-
PublicKeyDecryptionServiceImpl
public PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, java.lang.String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer) throws edu.vt.middleware.crypt.CryptException, java.io.IOException
Constructs the service with the required services and configuration.- Parameters:
aPrivateKeyPath
- The path on the file system to the private key to be used for decrypting any ciphers passed by the decryption server in CipherVersions retrieved from a storage.aPrivateKeyPassPhrase
- The pass phrase for decrypting the private key.aDecryptionServer
- The decryption server for accessing the cipher versions- Throws:
java.io.IOException
- in case of I/O problemsedu.vt.middleware.crypt.CryptException
- in case the cryptography algorithm had problems.
-
PublicKeyDecryptionServiceImpl
public PublicKeyDecryptionServiceImpl(java.lang.String aNamespace, java.lang.String aPrivateKeyPath, java.lang.String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory) throws edu.vt.middleware.crypt.CryptException, java.io.IOException
Constructs the service with the required services and configuration.- Parameters:
aPrivateKeyPath
- The path on the file system to the private key to be used for decrypting any ciphers passed by the decryption server in CipherVersions retrieved from a storage.aPrivateKeyPassPhrase
- The pass phrase for decrypting the private key.aDecryptionServer
- The decryption server for accessing the cipher versionsaCipherVersionFactory
- The factory to be used for creatingCipherVersion
instances.- Throws:
java.io.IOException
- in case of I/O problemsedu.vt.middleware.crypt.CryptException
- in case the cryptography algorithm had problems.
-
-
Method Detail
-
toSignature
protected java.lang.String toSignature(java.lang.String aMessage)
Creates a signature for the given message.- Specified by:
toSignature
in classAbstractDecryptionService
- Parameters:
aMessage
- The message for which a signature is to be generated- Returns:
- The signature for the message
-
createMessage
protected java.lang.String createMessage()
Creates a message for which a signature is to be created in order to authenticate for the retrieval of the cipher versions. A decryption server should deny any requests to get cipher versions in case the same message is used twice.- Specified by:
createMessage
in classAbstractDecryptionService
- Returns:
- The message
-
toDecryptedCipherVersion
protected <CV extends CipherVersion> CV toDecryptedCipherVersion(CV aEncyrptedCipherVersion)
To decrypted cipher version.- Specified by:
toDecryptedCipherVersion
in classAbstractDecryptionService
- Type Parameters:
CV
- the generic type- Parameters:
aEncyrptedCipherVersion
- the encyrpted cipher version- Returns:
- the cv
-
-