Class KANonce
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- org.opensaml.xmlsec.agreement.impl.KANonce
-
- All Implemented Interfaces:
Cloneable,Component,DestructableComponent,InitializableComponent,CloneableKeyAgreementParameter,KeyAgreementParameter,XMLExpressableKeyAgreementParameter
public class KANonce extends AbstractInitializableComponent implements XMLExpressableKeyAgreementParameter, CloneableKeyAgreementParameter
Key agreement parameter to support use ofKANoncevalues.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKANonce.ParserImplementation ofKeyAgreementParameterParser.
-
Field Summary
Fields Modifier and Type Field Description static IntegerDEFAULT_GENERATED_LENGTHDefault length for generated salt, in bytes.private IntegergeneratedLengthGenerated salt length, in bytes.private SecureRandomsecureRandomSecureRandom generator for salt.private StringvalueBase64-encoded nonce value.
-
Constructor Summary
Constructors Constructor Description KANonce()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description XMLObjectbuildXMLObject()KANonceclone()protected voiddoInitialize()static KANoncefromXMLObject(KANonce xmlObject)Create and initialize a new instance from the specifiedXMLObject.protected StringgenerateValue()Generate a new random value.IntegergetGeneratedLength()Get the generated length, in bytes.SecureRandomgetRandom()Get the secure random generator.StringgetValue()Get the Base64-encoded nonce value.voidsetGeneratedLength(Integer length)Set the generated length, in bytes.voidsetRandom(SecureRandom sr)Set the secure random generator.voidsetValue(String newValue)Set the Base64-encoded nonce value.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
DEFAULT_GENERATED_LENGTH
public static final Integer DEFAULT_GENERATED_LENGTH
Default length for generated salt, in bytes.
-
value
@Nullable private String value
Base64-encoded nonce value.
-
generatedLength
@NonnullAfterInit private Integer generatedLength
Generated salt length, in bytes.
-
secureRandom
@NonnullAfterInit private SecureRandom secureRandom
SecureRandom generator for salt.
-
-
Method Detail
-
getValue
@Nullable public String getValue()
Get the Base64-encoded nonce value.- Returns:
- the nonce value
-
setValue
public void setValue(@Nullable String newValue)Set the Base64-encoded nonce value.- Parameters:
newValue- the nonce value
-
getGeneratedLength
@NonnullAfterInit public Integer getGeneratedLength()
Get the generated length, in bytes.- Returns:
- the generated length, in bytes
-
setGeneratedLength
public void setGeneratedLength(@Nullable Integer length)Set the generated length, in bytes.- Parameters:
length- the generated length
-
getRandom
@NonnullAfterInit public SecureRandom getRandom()
Get the secure random generator.Defaults to the platform default via
new SecureRandom()- Returns:
- the secure random instance
-
setRandom
public void setRandom(@Nullable SecureRandom sr)Set the secure random generator.Defaults to the platform default via
new SecureRandom()- Parameters:
sr- the secure random generator to set
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
generateValue
protected String generateValue()
Generate a new random value.- Returns:
- the generated value
-
clone
public KANonce clone()
- Specified by:
clonein interfaceCloneableKeyAgreementParameter- Overrides:
clonein classObject
-
buildXMLObject
@Nonnull public XMLObject buildXMLObject()
- Specified by:
buildXMLObjectin interfaceXMLExpressableKeyAgreementParameter
-
fromXMLObject
@Nonnull public static KANonce fromXMLObject(@Nonnull KANonce xmlObject) throws ComponentInitializationException
Create and initialize a new instance from the specifiedXMLObject.- Parameters:
xmlObject- the XML object- Returns:
- new parameter instance
- Throws:
ComponentInitializationException- if component initialization fails
-
-