Package com.exedio.cope.pattern
Class Hash
java.lang.Object
com.exedio.cope.Feature
com.exedio.cope.Pattern
com.exedio.cope.pattern.Hash
- All Implemented Interfaces:
HashInterface,Settable<String>,Serializable
- Direct Known Subclasses:
MD5Hash,MessageDigestHash,SHAHash
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic final classA plain text is either too short, too long or doesn't match the format requirementstatic classValidate plain text for potential limits, to be specified in sub classes -
Constructor Summary
ConstructorsConstructorDescriptionHash(Hash.Algorithm algorithm) Hash(Hash.Algorithm algorithm, String encoding) Deprecated.Hash(Hash.Algorithm algorithm, Charset charset) Hash(HashAlgorithm algorithm) Hash(StringField storage, Hash.Algorithm algorithm) Hash(StringField storage, Hash.Algorithm algorithm, String encoding) Deprecated.UseHash(StringField, Algorithm, Charset)insteadHash(StringField storage, Hash.Algorithm algorithm, Charset charset) Hash(StringField storage, HashAlgorithm algorithm) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidDeprecated.Useblind(String)instead.final voidWastes (almost) as much cpu cycles, as a call tocheck(Item, String)would have needed.final booleanfinal voidcheckPlainText(String plainText) final SetValue<?>[]final Hash.AlgorithmDeprecated.UsegetAlgorithm2()instead.final HashAlgorithmfinal Stringfinal StringDeprecated.UsegetAlgorithmID()insteadfinal StringDeprecated.Throws exception if not initialized viaHash.Algorithm.final StringReturns the exceptions possibly thrown, when setting a value for this settable.final Class<?>final intfinal Hash.PlainTextValidatorfinal StringFieldfinal Stringfinal booleanisFinal()Returns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later.final booleanReturns true, if a value for the settable should be specified on the creation of an item.final booleanfinal Conditionfinal Conditionfinal ConditionisNull()final booleanfinal Conditionfinal Hashlimit(int plainTextLimit) Creates a new hash with a new plain text limit.final StringnewRandomPassword(SecureRandom random) final Hashoptional()final voidfinal voidfinal HashtoFinal()final Hashvalidate(Hash.PlainTextValidator validator) Methods inherited from class com.exedio.cope.Pattern
addSource, addSource, addSource, addSource, addSourceFeature, addSourceFeature, addSourceFeature, annotationField, equals, getGeneratedTypes, getSourceFeatures, getSourceFeaturesGather, getSourceFields, getSources, getSourceTypes, getType, hashCode, initialize, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newSourceType, newType, newType, onMount, registerSourceMethods inherited from class com.exedio.cope.Feature
afterModelCreated, getAbstractType, getAnnotation, getID, getLocalizationKeys, getName, getPattern, isAnnotationPresent, isSourceAlready, mount, readResolve, requireMounted, toString, toString, writeReplace
-
Constructor Details
-
Hash
-
Hash
-
Hash
-
Hash
-
Hash
-
Hash
-
Hash
Deprecated.UseHash(StringField, Algorithm, Charset)instead -
Hash
Deprecated.UseHash(Algorithm, Charset)instead
-
-
Method Details
-
getStorage
-
getPlainTextLimit
public final int getPlainTextLimit()- See Also:
-
getAlgorithm2
-
getAlgorithmID
-
getEncoding
Deprecated.Throws exception if not initialized viaHash.Algorithm. -
getPlainTextValidator
- See Also:
-
isInitial
public final boolean isInitial()Description copied from interface:SettableReturns true, if a value for the settable should be specified on the creation of an item. -
isFinal
public final boolean isFinal()Description copied from interface:SettableReturns true, if a value for the settable can be specified on the creation of an item only, thus cannot be modified later. -
isMandatory
public final boolean isMandatory()- Specified by:
isMandatoryin interfaceSettable<String>
-
getInitialType
- Specified by:
getInitialTypein interfaceSettable<String>
-
getInitialExceptions
Description copied from interface:SettableReturns the exceptions possibly thrown, when setting a value for this settable.- Specified by:
getInitialExceptionsin interfaceSettable<String>
-
toFinal
-
optional
-
limit
Creates a new hash with a new plain text limit. The default is 150. Setting hashes longer than the limit will cause anHash.InvalidPlainTextException.Checkingfor hashes longer than the limit will silently return false. This is a precaution against DOS attacks with very long plain texts.- See Also:
-
validate
- See Also:
-
set
- Specified by:
setin interfaceHashInterface
-
check
- Specified by:
checkin interfaceHashInterface
-
isNull
- Specified by:
isNullin interfaceHashInterface
-
blind
Wastes (almost) as much cpu cycles, as a call tocheck(Item, String)would have needed. Needed to prevent Timing Attacks. See https://en.wikipedia.org/wiki/Timing_attack- Specified by:
blindin interfaceHashInterface
-
execute
public final SetValue<?>[] execute(String value, Item exceptionItem) throws Hash.InvalidPlainTextException - Specified by:
executein interfaceSettable<String>- Throws:
Hash.InvalidPlainTextException
-
getHash
- Specified by:
getHashin interfaceHashInterface
-
setHash
-
hash
-
checkPlainText
-
isNull
-
isNull
-
isNotNull
-
isNotNull
-
newRandomPassword
- Specified by:
newRandomPasswordin interfaceHashInterface
-
getAlgorithmName
Deprecated.UsegetAlgorithmID()instead -
getAlgorithm
Deprecated.UsegetAlgorithm2()instead. Throws exception if not initialized viaHash.Algorithm. -
blind
Deprecated.Useblind(String)instead.
-
Hash(Algorithm, Charset)instead