/** * @return a new {@link KeysetHandle} that contains a single fresh key generated according to * {@code keyTemplate}. * @throws GeneralSecurityException */ public static final KeysetHandle generateNew(KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); }
/** * Generate a new key and add it to the keyset. */ private KeysetHandle rotateKey(KeysetHandle keysetHandle) throws GeneralSecurityException { return KeysetManager.withKeysetHandle(keysetHandle).rotate(HybridKeyTemplates.ECIES_P256_HKDF_HMAC_SHA256_AES128_GCM).getKeysetHandle(); }