Package org.webpki.crypto
Class CryptoRandom
java.lang.Object
org.webpki.crypto.CryptoRandom
Support class to
SecureRandom
.-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
generateRandom
(int length) Generates byte array with random data.static String
generateURLFriendlyRandom
(int length) Generates a URL friendly encoded nonce.
-
Method Details
-
generateRandom
public static byte[] generateRandom(int length) Generates byte array with random data.- Parameters:
length
- Number of bytes- Returns:
- byteArray
-
generateURLFriendlyRandom
Generates a URL friendly encoded nonce.Note: although the characters are derived from Bas64URL, the string is NOT intended to be decoded!
- Parameters:
length
- Number of characters- Returns:
- Encoded nonce
-