Create Versioned Key
Create an
NAEParameterSpecobject. To create a versioned key, the constructor needs the following parameters:name (String),exportable (boolean),deletable (boolean),versioned (boolean),length (int),attrs (CustomAttributes), andsession (NAESession).Obtain an instance of
KeyGenerator. Pass the key algorithm and provider name (IngrianProvider) as arguments.Initialize the cipher for encryption.
Call the
generateKeymethod of theKeyGeneratorobject to create the key.
Code sample
The following code sample generates a global AES key named mykey.
NAESession session = NAESession.getSession("user1", "password1".toCharArray());
CustomAttributes attr = new CustomAttributes();
attr.addAttributeForKeyName(attributeName1, attributeValue1);
attr.addAttributeForKeyName(attributeName2, attributeValue2);
UserKeysDetail keyNames = NAEKey.getKeyNames(attr, fingerPrint, keyOffset,maxKeys, session,operator));
The first version of the key is automatically created.