public class StatelessHmacNonceManager implements NonceManager
Stateless nonce manager implementation with HMAC verification and timeout. Every nonce provided by this manager consist of a random part, timestamp and HMAC.
| Constructor and Description |
|---|
StatelessHmacNonceManager(javax.crypto.spec.SecretKeySpec keySpec,
java.lang.String algorithm,
long timeoutMillis,
kotlin.jvm.functions.Function0<java.lang.String> nonceGenerator)
Stateless nonce manager implementation with HMAC verification and timeout.
Every nonce provided by this manager consist of a random part, timestamp and HMAC.
|
StatelessHmacNonceManager(byte[] key,
java.lang.String algorithm,
long timeoutMillis,
kotlin.jvm.functions.Function0<java.lang.String> nonceGenerator)
Helper constructor that makes a secret key from key ByteArray
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAlgorithm()
HMAC algorithm name,
|
javax.crypto.spec.SecretKeySpec |
getKeySpec()
secret key spec for HMAC
|
kotlin.jvm.functions.Function0<java.lang.String> |
getNonceGenerator()
function that produces random values
|
long |
getTimeoutMillis()
specifies the amount of time for a nonce to be considered valid
|
java.lang.Object |
newNonce(kotlin.coroutines.experimental.Continuation<? super java.lang.String> p)
Generate new nonce instance
|
java.lang.Object |
verifyNonce(java.lang.String nonce,
kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Verify nonce value
|
newNonce, verifyNoncepublic StatelessHmacNonceManager(javax.crypto.spec.SecretKeySpec keySpec,
java.lang.String algorithm,
long timeoutMillis,
kotlin.jvm.functions.Function0<java.lang.String> nonceGenerator)
Stateless nonce manager implementation with HMAC verification and timeout. Every nonce provided by this manager consist of a random part, timestamp and HMAC.
keySpec - secret key spec for HMACalgorithm - HMAC algorithm name, HmacSHA256 by defaulttimeoutMillis - specifies the amount of time for a nonce to be considered validnonceGenerator - function that produces random valuespublic StatelessHmacNonceManager(byte[] key,
java.lang.String algorithm,
long timeoutMillis,
kotlin.jvm.functions.Function0<java.lang.String> nonceGenerator)
Helper constructor that makes a secret key from key ByteArray
public java.lang.Object newNonce(kotlin.coroutines.experimental.Continuation<? super java.lang.String> p)
Generate new nonce instance
public java.lang.Object verifyNonce(java.lang.String nonce,
kotlin.coroutines.experimental.Continuation<? super java.lang.Boolean> p)
Verify nonce value
true if nonce is validpublic javax.crypto.spec.SecretKeySpec getKeySpec()
secret key spec for HMAC
public java.lang.String getAlgorithm()
HMAC algorithm name,
HmacSHA256 by default
public long getTimeoutMillis()
specifies the amount of time for a nonce to be considered valid
public kotlin.jvm.functions.Function0<java.lang.String> getNonceGenerator()
function that produces random values