Package org.refcodes.forwardsecrecy
Class InMemoryDecryptionServer
- java.lang.Object
-
- org.refcodes.forwardsecrecy.InMemoryDecryptionServer
-
- All Implemented Interfaces:
DecryptionServer
public class InMemoryDecryptionServer extends Object implements DecryptionServer
TheInMemoryDecryptionServer
is a non-persisting implementation of theDecryptionServer
managing theCipherVersion
instances in memory only. This implementation provides means to easily set up a quick and dirty test setup. TheInMemoryDecryptionServer
is the counterpart of theInMemoryEncryptionServer
which both work (not doing any persistence) hand in hand.
-
-
Constructor Summary
Constructors Constructor Description InMemoryDecryptionServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addCipherVersion(String aNamespace, CipherVersion aCipherVersion)
Adds a cipher version to the server.List<CipherVersion>
getCipherVersions(String aNamespace, String aMessage, String aSignature)
Returns the currently available cipher versions.
-
-
-
Method Detail
-
getCipherVersions
public List<CipherVersion> getCipherVersions(String aNamespace, String aMessage, String aSignature)
Returns the currently available cipher versions. An implementation might just make use of anObjectOutputStream
. Though the stream is encrypted with the public key of the message signer. ------------------------------------------------------------------------- Another approach might not return a stream, it might return a list containing the cipher versions with the ciphers being encrypted by the public key. Or a stream is returned which is not encrypted but the ciphers in the cipher versions carried by the stream. -------------------------------------------------------------------------- Specified by:
getCipherVersions
in interfaceDecryptionServer
- Parameters:
aNamespace
- The namespace for which to get the cipher versions.aMessage
- A message to be signed by the requester of the cipher version.aSignature
- The signature of the requester so that the according public key for encryption can be determined and the origin can be verified.- Returns:
- A list as with the currently known cipher versions. The ciphers contained therein might be encrypted!
-
addCipherVersion
protected void addCipherVersion(String aNamespace, CipherVersion aCipherVersion) throws CipherUidAlreadyInUseException
Adds a cipher version to the server. Bad hack for testing purposes.- Parameters:
aNamespace
- The namespace for which to add the cipheraCipherVersion
- The cipher version with cipher UID and cipher.- Throws:
CipherUidAlreadyInUseException
- in case the given cipher UID has already been used.
-
-