public final class NonceUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.bouncycastle.crypto.prng.drbg.SP80090DRBG |
newRBG(org.bouncycastle.crypto.Digest digest,
int length)
Creates a new hash-based DRBG instance that uses the given digest as the
pseudorandom source.
|
static org.bouncycastle.crypto.prng.drbg.SP80090DRBG |
newRBG(int length)
Creates a new DRBG instance based on a SHA-256 digest.
|
static byte[] |
nist80038d(int length)
Generates a nonce/IV using the strategy described in NIST
SP-800-38d, section 8.2.2, "RBG-based Construction".
|
static byte[] |
nist80063a(org.bouncycastle.crypto.BlockCipher cipher)
Generates a random IV according to NIST
SP-800-63a, appendix C, method 2 (pseudorandom), suitable for use with
any block cipher mode described in that standard.
|
static byte[] |
nist80063a(org.bouncycastle.crypto.BlockCipher cipher,
SecretKey key)
Generates a random IV according to NIST
SP-800-63a, appendix C, method 1 (encrypted nonce), suitable for use
with any block cipher mode described in that standard.
|
static byte[] |
nist80063a(org.bouncycastle.crypto.prng.SP800SecureRandom prng,
int blockSize)
Generates a random IV according to NIST
SP-800-63a, appendix C, method 2 (pseudorandom), suitable for use with
any block cipher mode described in that standard.
|
static byte[] |
timestampNonce(int length)
Generates a nonce of the given size by repetitively concatenating system
timestamps (i.e.
|
public static byte[] timestampNonce(int length)
System.nanoTime()) up to the required size.length - Positive number of bytes in nonce.public static byte[] nist80038d(int length)
This nonce generation strategy is suitable for GCM ciphers.
length - Number of bytes in nonce; MUST be 12 or more.public static byte[] nist80063a(org.bouncycastle.crypto.BlockCipher cipher,
SecretKey key)
EncryptedNonce for the implementation.cipher - Block cipher.key - Encryption key intended for use with IV.EncryptedNoncepublic static byte[] nist80063a(org.bouncycastle.crypto.prng.SP800SecureRandom prng,
int blockSize)
prng - NIST SP800-63a approved pseudorandom number generator.blockSize - Cipher block size in bytes.public static byte[] nist80063a(org.bouncycastle.crypto.BlockCipher cipher)
RBGNonce internally with length equal to block size of given
cipher.cipher - Block cipher.RBGNoncepublic static org.bouncycastle.crypto.prng.drbg.SP80090DRBG newRBG(int length)
length - Length in bits of values to be produced by DRBG instance.public static org.bouncycastle.crypto.prng.drbg.SP80090DRBG newRBG(org.bouncycastle.crypto.Digest digest,
int length)
digest - Digest algorithm.length - Length in bits of values to be produced by DRBG instance.Copyright © 2016 JBoss by Red Hat. All rights reserved.