Create global key
Create an
NAEParameterSpec
object. Pass the keyname as an argument.Obtain an instance of
KeyGenerator
. Pass the key algorithm and provider name (IngrianProvider) as arguments.Call the
generateKey
method of theKeyGenerator
object to create the key.
Code sample
The following sample generates a global key AES key named mykey.
To mark a global key exportable and deletale, pass the boolean values to the NAEParameterSpec
object. The following sample shows how to make mykey exportable and deletable:
To mark a global key exportable and non-deletable and specify key size for a key, pass the boolean values and key size to the NAEParameterSpec
object. The following sample shows how to make mykey exportable and non-deletable and assign the key bit length to 256 bits.
Note
Global keys cannot be created with KMIP.