Class CryptoUtils


  • public class CryptoUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<byte[]> decrypt​(byte[] encMessage, java.security.Key secretKey)  
      static java.util.Optional<byte[]> decrypt​(byte[] encMessage, java.security.Key secretKey, int gcmIvLengthInBytes, int gcmTagLengthInBytes)  
      static byte[] ecka​(java.security.PrivateKey prk, java.security.PublicKey puk)  
      static byte[] hkdf​(byte[] ikm, byte[] info, int lengthInBytes)  
      static byte[] hkdf​(byte[] ikm, java.lang.String info, int lengthInBytes)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • ecka

        public static byte[] ecka​(java.security.PrivateKey prk,
                                  java.security.PublicKey puk)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException,
                                  java.security.InvalidKeyException
        Throws:
        java.security.NoSuchAlgorithmException
        java.security.NoSuchProviderException
        java.security.InvalidKeyException
      • hkdf

        public static byte[] hkdf​(byte[] ikm,
                                  java.lang.String info,
                                  int lengthInBytes)
                           throws java.lang.IllegalArgumentException,
                                  org.bouncycastle.crypto.DataLengthException
        Throws:
        java.lang.IllegalArgumentException
        org.bouncycastle.crypto.DataLengthException
      • hkdf

        public static byte[] hkdf​(byte[] ikm,
                                  byte[] info,
                                  int lengthInBytes)
                           throws java.lang.IllegalArgumentException,
                                  org.bouncycastle.crypto.DataLengthException
        Throws:
        java.lang.IllegalArgumentException
        org.bouncycastle.crypto.DataLengthException
      • decrypt

        public static java.util.Optional<byte[]> decrypt​(byte[] encMessage,
                                                         java.security.Key secretKey)
      • decrypt

        public static java.util.Optional<byte[]> decrypt​(byte[] encMessage,
                                                         java.security.Key secretKey,
                                                         int gcmIvLengthInBytes,
                                                         int gcmTagLengthInBytes)