@Test public void testGenerateNew() throws Exception { KeyTemplate kt = AesGcmKeyManager.aes128GcmTemplate(); KeysetHandle handle = KeysetHandle.generateNew(kt); Keyset keyset = handle.getKeyset(); assertThat(keyset.getKeyCount()).isEqualTo(1); Keyset.Key key = keyset.getKey(0); assertThat(keyset.getPrimaryKeyId()).isEqualTo(key.getKeyId()); assertThat(key.getStatus()).isEqualTo(KeyStatusType.ENABLED); assertThat(key.getOutputPrefixType()).isEqualTo(OutputPrefixType.TINK); assertThat(key.hasKeyData()).isTrue(); assertThat(key.getKeyData().getTypeUrl()).isEqualTo(kt.getTypeUrl()); AesGcmKeyFormat aesGcmKeyFormat = AesGcmKeyFormat.parseFrom(kt.getValue(), ExtensionRegistryLite.getEmptyRegistry()); AesGcmKey aesGcmKey = AesGcmKey.parseFrom(key.getKeyData().getValue(), ExtensionRegistryLite.getEmptyRegistry()); assertThat(aesGcmKey.getKeyValue().size()).isEqualTo(aesGcmKeyFormat.getKeySize()); }
@Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); }
KeysetHandle { @Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); } }
KeysetHandle { @Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); } private  KeysetHandle(Keyset keyset); }
KeysetHandle { @Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); } private  KeysetHandle(Keyset keyset); KeysetInfo getKeysetInfo(); @Deprecated static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate); static final KeysetHandle generateNew(KeyTemplate keyTemplate); static final KeysetHandle read(KeysetReader reader, Aead masterKey); static final KeysetHandle readNoSecret(KeysetReader reader); static final KeysetHandle readNoSecret(final byte[] serialized); void write(KeysetWriter keysetWriter, Aead masterKey); void writeNoSecret(KeysetWriter writer); KeysetHandle getPublicKeysetHandle(); @Override String toString(); static void assertEnoughKeyMaterial(Keyset keyset); static void assertEnoughEncryptedKeyMaterial(EncryptedKeyset keyset); P getPrimitive(Class<P> targetClassObject); P getPrimitive(KeyManager<P> customKeyManager, Class<P> targetClassObject); }
KeysetHandle { @Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate) throws GeneralSecurityException { return KeysetManager.withEmptyKeyset().rotate(keyTemplate).getKeysetHandle(); } private  KeysetHandle(Keyset keyset); KeysetInfo getKeysetInfo(); @Deprecated static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate); static final KeysetHandle generateNew(KeyTemplate keyTemplate); static final KeysetHandle read(KeysetReader reader, Aead masterKey); static final KeysetHandle readNoSecret(KeysetReader reader); static final KeysetHandle readNoSecret(final byte[] serialized); void write(KeysetWriter keysetWriter, Aead masterKey); void writeNoSecret(KeysetWriter writer); KeysetHandle getPublicKeysetHandle(); @Override String toString(); static void assertEnoughKeyMaterial(Keyset keyset); static void assertEnoughEncryptedKeyMaterial(EncryptedKeyset keyset); P getPrimitive(Class<P> targetClassObject); P getPrimitive(KeyManager<P> customKeyManager, Class<P> targetClassObject);  }