Wrap Key
Wrapping a key enables secure transfer of the key from one place to another. CADP for Java KMIP provider wraps an NAEKey
object by encrypting it with a specified AES Symmetric Key.
To wrap a key:
Create a symmetric key and a symmetric wrapping key.
Register a normal AES symmetric key.
String wrapping_keybytes = "49E3BD09F079E4F8842F1C6620FFF6EC"; uniqueIdentifier_wrappingkey = key_wrappingkey.registerKe (IngrianProvider.hex2ByteArray(wrapping_keybytes), algorithm, keyFormat, spec);
Register a symmetric wrapping key.
String wrapped_keybytes = "92F6355221CC38DF5F374275631C774D"; uniqueIdentifier_wrappedkey = key_wrappedkey.registerKe (IngrianProvider.hex2ByteArray(wrapped_keybytes), algorithm, keyFormat, spec2);
Get the encrypted key bytes of the key using Wrapping key. Use the
wrap()
method of theKMIPSession
API.byte[] byte_wrappedkey = session.wrapKey(wrapped_key, initialAttributes1);