Class IdAuthSecurityManager


  • @Component
    public class IdAuthSecurityManager
    extends Object
    The Class IdAuthSecurityManager.
    Author:
    Manoj SP
    • Constructor Detail

      • IdAuthSecurityManager

        public IdAuthSecurityManager()
    • Method Detail

      • getUser

        public String getUser()
        Gets the user.
        Returns:
        the user
      • reEncryptRandomKey

        public String reEncryptRandomKey​(String encryptedKey)
        Re encrypt random key.
        Parameters:
        encryptedKey - the encrypted key
        Returns:
        the string
      • reEncryptAndStoreRandomKey

        public void reEncryptAndStoreRandomKey​(String index,
                                               String key)
        Re encrypt and store random key.
        Parameters:
        index - the index
        key - the key
      • sign

        public String sign​(String data)
        Sign.
        Parameters:
        data - the data
        Returns:
        the string
      • verifySignature

        public boolean verifySignature​(String signature,
                                       String domain,
                                       String requestData,
                                       Boolean isTrustValidationRequired)
        Verify signature.
        Parameters:
        signature - the signature
        domain - the domain
        requestData - the request data
        isTrustValidationRequired - the is trust validation required
        Returns:
        true, if successful
      • getSaltKeyForId

        public int getSaltKeyForId​(String id)
      • encrypt

        public reactor.util.function.Tuple2<byte[],​byte[]> encrypt​(PublicKey publicKey,
                                                                         byte[] dataToEncrypt)
        Encrypt.
        Parameters:
        publicKey - the public key
        dataToEncrypt - the data to encrypt
        Returns:
        the byte[]
      • combineDataToEncrypt

        public byte[] combineDataToEncrypt​(byte[] encryptedData,
                                           byte[] encryptedSymmetricKey)
        Combine data to encrypt.
        Parameters:
        encryptedData - the encrypted data
        encryptedSymmetricKey - the encrypted symmetric key
        Returns:
        the byte[]
      • trimBeginEnd

        public static String trimBeginEnd​(String pKey)
        Trim begin end.
        Parameters:
        pKey - the key
        Returns:
        the string
      • digestAsPlainText

        public static String digestAsPlainText​(byte[] data)
        Digest as plain text.
        Parameters:
        data - the data
        Returns:
        the string
      • generateHashAndDigestAsPlainText

        public static String generateHashAndDigestAsPlainText​(byte[] data)
        Generate hash and digest as plain text.
        Parameters:
        data - the data
        Returns:
        the string
      • decodeHex

        public static byte[] decodeHex​(String hexData)
                                throws org.apache.commons.codec.DecoderException
        Decode hex.
        Parameters:
        hexData - the hex data
        Returns:
        the byte[]
        Throws:
        org.apache.commons.codec.DecoderException - the decoder exception
      • toHex

        public static String toHex​(byte[] bytes)
        To hex.
        Parameters:
        bytes - the bytes
        Returns:
        the string
      • getBytesFromThumbprint

        public static byte[] getBytesFromThumbprint​(String thumbprint)
        Gets the bytes from thumbprint.
        Parameters:
        thumbprint - the thumbprint
        Returns:
        the bytes from thumbprint
      • generateKeyedHash

        public String generateKeyedHash​(byte[] bytesToHash)
      • signWithPayload

        public String signWithPayload​(String data)
      • jwsSignWithPayload

        public String jwsSignWithPayload​(String data)
      • jwtEncrypt

        public String jwtEncrypt​(String dataToEncrypt,
                                 String certificateData)
      • generateArgon2Hash

        public String generateArgon2Hash​(String anyString,
                                         String salt)