Exemplo n.º 1
0
 public TPMKey findKeyByUUID(UUID uuid)
     throws TrustedComputingException, ClassCastException, ClassNotFoundException,
         InstantiationException, IllegalAccessException, InvalidInputException {
   KeyManager km = getKeyManager();
   UUID[] keys = km.getStoredTPMKeys();
   StorageRootKey srk = km.loadStorageRootKey(Secret.WELL_KNOWN_SECRET);
   for (UUID u : keys) {
     // System.out.print("Does key : " + uuid + " match with " + u.toString());
     if (u.equals(uuid)) {
       // System.out.println("... yes.");
       TPMKey key = km.loadTPMKey(srk, u, Secret.WELL_KNOWN_SECRET);
       closeContext();
       return key;
     } else {
       // System.out.println("... no.");
     }
   }
   throw new InvalidInputException("Key with this UUID: " + uuid.toString() + " not found");
 }