Class OxalisCipherConverter


  • public class OxalisCipherConverter
    extends Object
    Author:
    steinar Date: 14.05.13 Time: 09:57
    • Constructor Detail

      • OxalisCipherConverter

        public OxalisCipherConverter()
    • Method Detail

      • createCipherFromWrappedHexKey

        public OxalisCipher createCipherFromWrappedHexKey​(String wrappedSymmetricKeyAsHexString,
                                                          PrivateKey privateKey)
        Creates an instance of OxalisCipher:
        1. Decodes the supplied hex string representation of a wrapped key into an array of bytes representation
        2. Creates a cipher, which is initialized with a private key
        3. Unwraps (decrypts) the secret key represented by an array of bytes into a SecretKey
        4. Creates an OxalisCipher using the unwrapped SecretKey
      • getWrappedSymmetricKeyAsString

        public String getWrappedSymmetricKeyAsString​(PublicKey publicKey,
                                                     OxalisCipher oxalisCipher)
        Encrypts the secret key (symmetric key) held inside the OxalisCipher instance using the supplied PublicKey, after which the resulting wrapped secret key is transformed into a hex string suitable for transmission, persistence etc.
        Parameters:
        publicKey - the public asymmetric key to use for encrypting the secret symmetric key
        oxalisCipher - the instance of OxalisCipher in which the secret symmetric key is held.
        Returns: