aws-samples / aws-cloudhsm-jce-examples

Sample applications demonstrating how to use the CloudHSM JCE
MIT No Attribution
36 stars 56 forks source link

Example for KeyAttributes/Properties #80

Open narasimhaks opened 9 months ago

narasimhaks commented 9 months ago

Hi,

We are trying to migrate from CloudHSM Client v3.x to v5.x and we were using the CaviumKey to get all the key properties like

key.isPersistent() key.isExtractable() key.getAlgorithm() key.getSize() key.getLabel()

The KeyUtilitiesRunner.java in master has the below implementation.

private static void displayKeyInfo(CaviumKey key) {
        if (null != key) {
            System.out.printf("Key handle %d with label %s\n", key.getHandle(), key.getLabel());
            // Display whether the key can be extracted from the HSM.
            System.out.println("Is Key Extractable? : " + key.isExtractable());

            // Display whether this key is a token key.
            System.out.println("Is Key Persistent? : " + key.isPersistent());

            // The algorithm and size used to generate this key.
            System.out.println("Key Algo : " + key.getAlgorithm());
            System.out.println("Key Size : " + key.getSize());
        }
    }

Can you please provide a similar sample for SDK5

Thanks Narasimha