Class Nonce

java.lang.Object
de.uplanet.security.Nonce

@Scriptable public final class Nonce extends Object
Used to create cryptographically secure random bits that can be used as nonce values.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    getBinary(int p_iLen)
    Create a cryptographically secure hex-encoded nonce value of the given length in bytes.
    static String
    getString(int p_iLen)
    Create a cryptographically secure hex-encoded nonce value of the given length in bytes.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getString

      public static String getString(int p_iLen)
      Create a cryptographically secure hex-encoded nonce value of the given length in bytes.

      Note that the length of the returned hex-encoded string is twice of the length in bytes.

      Parameters:
      p_iLen - The length of the nonce value in bytes.
      Returns:
      The hex-encoded nonce value.
    • getBinary

      public static byte[] getBinary(int p_iLen)
      Create a cryptographically secure hex-encoded nonce value of the given length in bytes.
      Parameters:
      p_iLen - The length of the nonce value in bytes.
      Returns:
      The nonce value.