Class CryptoUtils

java.lang.Object
org.yamcs.security.CryptoUtils

public class CryptoUtils extends Object
  • Constructor Details

    • CryptoUtils

      public CryptoUtils()
  • Method Details

    • generateRandomSecretKey

      public static byte[] generateRandomSecretKey()
      Generates a difficult to guess random key via SecureRandom using the HmacSHA1 algorithm
    • generateRandomPassword

      public static String generateRandomPassword(int length)
      Generates a random strong password.
    • calculateHmac

      public static byte[] calculateHmac(String data, byte[] secret)
      Calculates an hmac as specified in RFC2104.
    • calculateHmac

      public static byte[] calculateHmac(byte[] data, byte[] secret)
      Calculates an hmac as specified in RFC2104.
    • generatePKCE

      public static CryptoUtils.PKCE generatePKCE()
      Generates an OAuth 2.0 Proof Key for Code Exchange (PKCE) code challenge and verifier (RFC6736)
       code_challenge = BASE64URLENCODE(SHA256(ASCII(code_verifier)))