Export Versioned Key
You can export the default version, a specific version, or all key versions. You cannot export retired versions of a versioned key.
To export the default version, call the NAEkey.export
method for that key.
NAEKey key = NAEKey.getSecretKey(keyname, session);
KeyExportData keyData = key.export();
To export a specific version, you must append a #
plus the version number. The export method exports that version only. For example, to return two versions of the key, use the following snippet.
NAEKey key = NAEKey.getSecretKey(keyname+"#2", session);
byte[] keyData = key.export();
To export all versions, call the NAEKey.export
method and pass the boolean true. Place the values in an array.
#!bash
NAEKey key = NAEKey.getSecretKey(keyname, session);
byte[] keyData = key.export();