Package org.refcodes.forwardsecrecy
Class AbstractEncryptionService
- java.lang.Object
-
- org.refcodes.forwardsecrecy.AbstractEncryptionService
-
- All Implemented Interfaces:
Iterator<CipherVersion>
,CipherVersionGenerator<CipherVersion>
,EncryptionService
,org.refcodes.generator.Generator<CipherVersion>
- Direct Known Subclasses:
LoopbackEncryptionService
,PublicKeyEncryptionService
public abstract class AbstractEncryptionService extends Object implements EncryptionService
Abstract base implementation for non abstractEncryptionService
implementations.
-
-
Constructor Summary
Constructors Constructor Description AbstractEncryptionService(String aNamespace, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator)
Constructs the service with the required services and configuration.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
CipherVersion
next()
Generator method to be implemented by subclasses.void
remove()
protected abstract <CV extends CipherVersion>
CVtoEncryptedCipherVersion(CV aDecyrptedCipherVersion)
Hook factory method to be implemented by subclasses.-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Constructor Detail
-
AbstractEncryptionService
public AbstractEncryptionService(String aNamespace, EncryptionServer aEncryptionServer, CipherVersionGenerator<CipherVersion> aCipherVersionGenerator)
Constructs the service with the required services and configuration.- Parameters:
aNamespace
- The name space to which this service belongsaEncryptionServer
- The server to which the service is being "connected"aCipherVersionGenerator
- The generator to be used for generatingCipherVersion
instances.
-
-
Method Detail
-
next
public CipherVersion next()
Generator method to be implemented by subclasses. Required to create implementation dependent cipher version objects. Retrieves the next valid cipher which may be used for encrypting data.- Specified by:
next
in interfaceCipherVersionGenerator<CipherVersion>
- Specified by:
next
in interfaceorg.refcodes.generator.Generator<CipherVersion>
- Specified by:
next
in interfaceIterator<CipherVersion>
- Returns:
- The next valid
CipherVersion
for encryption.
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceorg.refcodes.generator.Generator<CipherVersion>
- Specified by:
hasNext
in interfaceIterator<CipherVersion>
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<CipherVersion>
-
toEncryptedCipherVersion
protected abstract <CV extends CipherVersion> CV toEncryptedCipherVersion(CV aDecyrptedCipherVersion)
Hook factory method to be implemented by subclasses. The provided cipher is to be encrypted (e.g. with the public key of an asymmetric encryption approach) so that an Encryption-Server only receives encrypted data.- Type Parameters:
CV
- The type of theCipherVersion
to be used.- Parameters:
aDecyrptedCipherVersion
- TheCipherVersion
to be encrypted.- Returns:
- The encrypted
CipherVersion
.
-
-