Class InMemoryDecryptionServer

java.lang.Object
org.refcodes.forwardsecrecy.InMemoryDecryptionServer
All Implemented Interfaces:
DecryptionServer

public class InMemoryDecryptionServer extends Object implements DecryptionServer
The InMemoryDecryptionServer is a non-persisting implementation of the DecryptionServer managing the CipherVersion instances in memory only. This implementation provides means to easily set up a quick and dirty test setup. The InMemoryDecryptionServer is the counterpart of the InMemoryEncryptionServer which both work (not doing any persistence) hand in hand.
  • Constructor Details

    • InMemoryDecryptionServer

      public InMemoryDecryptionServer()
  • Method Details

    • getCipherVersions

      public List<CipherVersion> getCipherVersions(String aNamespace, String aMessage, String aSignature)
      Returns the currently available cipher versions. An implementation might just make use of an ObjectOutputStream. Though the stream is encrypted with the public key of the aMessage 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 interface DecryptionServer
      Parameters:
      aNamespace - The namespace for which to get the cipher versions.
      aMessage - A aMessage 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 cipher
      aCipherVersion - The cipher version with cipher UID and cipher.
      Throws:
      CipherUidAlreadyInUseException - in case the given cipher UID has already been used.