Import Global Key
To get an instance of a non-global key (a key that is not accessible to all users), you must pass the session object to the getSecretKey method. The NAE Server then returns the key, provided that the key is accessible to the authenticated user.
Obtain the key bytes of the key.
Invoke the
importKeymethod of theNAEKeyclass. Pass the following arguments: key bytes, algorithm, and key name. The key name is specified as anNAEParameterSpecobject.
Code sample
The following code sample imports a global key named mykey:
byte [] rawkey = ...
String KeyName = NAEKey.importKey(rawkey, "AES", new NAEParameterSpec("mykey"));
The KeyName will be created on the Key Manager and it will have the key bytes that are imported.