Module org.refcodes.forwardsecrecy
Package org.refcodes.forwardsecrecy
Class PublicKeyDecryptionService
java.lang.Object
org.refcodes.forwardsecrecy.AbstractDecryptionService
org.refcodes.forwardsecrecy.PublicKeyDecryptionService
- All Implemented Interfaces:
DecryptionService
The
DecryptionService
retrieves CipherVersion
instances from
the DecryptionServer
and is decrypting the ciphers contained in the
CipherVersion
instances with a private key.-
Field Summary
Fields inherited from class org.refcodes.forwardsecrecy.AbstractDecryptionService
EXPIRE_TIME_IMMEDIATELY, EXPIRE_TIME_NEVER
-
Constructor Summary
ConstructorDescriptionPublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, long aCipherVersionsExpireTimeMillis) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory, long aCipherVersionsExpireTimeMillis) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, long aCipherVersionsExpireTimeMillis) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory) Constructs the service with the required services and configuration.PublicKeyDecryptionService
(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory, long aCipherVersionsExpireTimeMillis) Constructs the service with the required services and configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
Creates a aMessage 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 String
toSignature
(String aMessage) Creates a signature for the given aMessage.Methods inherited from class org.refcodes.forwardsecrecy.AbstractDecryptionService
getCipherVersions, getCipherVersionsExpireTimeMillis, setCipherVersionsExpireTimeMillis, withCipherVersionsExpireTimeMillis
-
Constructor Details
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory, long aCipherVersionsExpireTimeMillis) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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.aCipherVersionsExpireTimeMillis
- The time in milliseconds after which them loaded cipher versions expire and are reloaded. A value of 0 indicates that them cipher versions expire immediately (default). A value of -1 indicate that them cipher versions expire never.- Throws:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, DecryptionServer aDecryptionServer, long aCipherVersionsExpireTimeMillis) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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 versionsaCipherVersionsExpireTimeMillis
- The time in milliseconds after which them loaded cipher versions expire and are reloaded. A value of 0 indicates that them cipher versions expire immediately (default). A value of -1 indicate that them cipher versions expire never.- Throws:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, long aCipherVersionsExpireTimeMillis) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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 versionsaCipherVersionsExpireTimeMillis
- The time in milliseconds after which them loaded cipher versions expire and are reloaded. A value of 0 indicates that them cipher versions expire immediately (default). A value of -1 indicate that them cipher versions expire never.- Throws:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
PublicKeyDecryptionService
public PublicKeyDecryptionService(String aNamespece, String aPrivateKeyPath, String aPrivateKeyPassPhrase, DecryptionServer aDecryptionServer, CipherVersionFactory<CipherVersion> aCipherVersionFactory, long aCipherVersionsExpireTimeMillis) throws CryptException, IOException, InvalidKeySpecException, NoSuchAlgorithmException 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.aCipherVersionsExpireTimeMillis
- The time in milliseconds after which them loaded cipher versions expire and are reloaded. A value of 0 indicates that them cipher versions expire immediately (default). A value of -1 indicate that them cipher versions expire never.- Throws:
IOException
- in case of I/O problemsCryptException
- in case the cryptography algorithm had problems.NoSuchAlgorithmException
- thrown in case the cryptographic algorithm was not found.InvalidKeySpecException
- thrown in case an invalid key spec has been encountered.
-
-
Method Details
-
toSignature
Creates a signature for the given aMessage.- Specified by:
toSignature
in classAbstractDecryptionService
- Parameters:
aMessage
- The aMessage for which a signature is to be generated- Returns:
- The signature for the aMessage
-
createMessage
Creates a aMessage 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 aMessage is used twice.- Specified by:
createMessage
in classAbstractDecryptionService
- Returns:
- The aMessage
-
toDecryptedCipherVersion
To decrypted cipher version.- Specified by:
toDecryptedCipherVersion
in classAbstractDecryptionService
- Type Parameters:
CV
- the generic type- Parameters:
aEncyrptedCipherVersion
- the encyrpted cipher version- Returns:
- the cv
-