Generate KMIP Public-Private Key Pair
The user can get the group permissions applicable on an existing key through API.
Create an
NAEParameterSpec
object. Pass the keyname as an argument.Obtain an instance of
KeyPairGenerator
. Pass the key type as an argument.Call the
genKeyPair
method of theKeyPairGenerator
object.
Code sample
This code snippet generates two KMIP keys named myKeyPublic and myKeyPrivate owned by user1 that contain two custom attributes: first_attribute and second_attribute.
KMIP Objects MUST have unique names, so, by default, the KMIP key pairs are assigned with the suffixes Public or Private. Thus, if you generate testKey, the default result would be testKeyPublic and testKeyPrivate. If you do not want to use the default suffixes, configure them in the CADP_for_JAVA.properties
file and use these suffix config parameters:
KMIP_Private_Suffix
KMIP_Public_Suffix