Module org.refcodes.forwardsecrecy
Package org.refcodes.forwardsecrecy
Class AbstractCipherVersionGenerator<CV extends CipherVersion>
java.lang.Object
org.refcodes.forwardsecrecy.AbstractCipherVersionGenerator<CV>
- Type Parameters:
CV
- The type of theCipherVersion
to be generated.
- All Implemented Interfaces:
Iterator<CV>
,CipherVersionGenerator<CV>
,org.refcodes.generator.Generator<CV>
- Direct Known Subclasses:
CipherVersionGeneratorImpl
public abstract class AbstractCipherVersionGenerator<CV extends CipherVersion>
extends Object
implements CipherVersionGenerator<CV>
Default implementation of a cipher version generator.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractCipherVersionGenerator
(CipherVersionFactory<CV> aCipherVersionFactory) Constructor for theAbstractCipherVersionGenerator
. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
AbstractCipherVersionGenerator
Constructor for theAbstractCipherVersionGenerator
. The providedCipherVersionFactory
is used to create the actualCipherVersion
instances generated by thisCipherVersionGenerator
.- Parameters:
aCipherVersionFactory
- TheCipherVersionFactory
used to create theCipherVersion
instances of the required type.
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceorg.refcodes.generator.Generator<CV extends CipherVersion>
- Specified by:
hasNext
in interfaceIterator<CV extends CipherVersion>
-
remove
public void remove()- Specified by:
remove
in interfaceIterator<CV extends 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<CV extends CipherVersion>
- Specified by:
next
in interfaceorg.refcodes.generator.Generator<CV extends CipherVersion>
- Specified by:
next
in interfaceIterator<CV extends CipherVersion>
- Returns:
- The next valid
CipherVersion
for encryption.
-
createCipherUid
Hook factory method to be implemented by subclasses. A https://www.metacodes.pro algorithm can be used to generate unique cipher UIDs. In case the cipher UID is not unique, another one is requested until a cipher UID is found which is unique regarding the systems of forward secrecy cryptography architecture.- Returns:
- A more or less unique cipher UID.
-
createCipher
Hook factory method to be implemented by subclasses. A https://www.metacodes.pro algorithm is to be implemented creating a good random cipher.- Returns:
- A good random cipher.
-