test_class.file: java_src/src/test/java/com/google/crypto/tink/KeysetHandleTest.java
test_class.identifier: KeysetHandleTest
test_case.body: @Test
    public void testGetPublicKeysetHandle() throws Exception {
      KeysetHandle privateHandle = KeysetHandle.generateNew(SignatureKeyTemplates.ECDSA_P256);
      KeyData privateKeyData = privateHandle.getKeyset().getKey(0).getKeyData();
      EcdsaPrivateKey privateKey =
          EcdsaPrivateKey.parseFrom(
              privateKeyData.getValue(), ExtensionRegistryLite.getEmptyRegistry());
      KeysetHandle publicHandle = privateHandle.getPublicKeysetHandle();
      assertEquals(1, publicHandle.getKeyset().getKeyCount());
      assertEquals(
          privateHandle.getKeyset().getPrimaryKeyId(), publicHandle.getKeyset().getPrimaryKeyId());
      KeyData publicKeyData = publicHandle.getKeyset().getKey(0).getKeyData();
      assertEquals(SignatureConfig.ECDSA_PUBLIC_KEY_TYPE_URL, publicKeyData.getTypeUrl());
      assertEquals(KeyData.KeyMaterialType.ASYMMETRIC_PUBLIC, publicKeyData.getKeyMaterialType());
      assertArrayEquals(
          privateKey.getPublicKey().toByteArray(), publicKeyData.getValue().toByteArray());
  
      PublicKeySign signer = PublicKeySignFactory.getPrimitive(privateHandle);
      PublicKeyVerify verifier = PublicKeyVerifyFactory.getPrimitive(publicHandle);
      byte[] message = Random.randBytes(20);
      try {
        verifier.verify(signer.sign(message), message);
      } catch (GeneralSecurityException e) {
        fail("Should not fail: " + e);
      }
    }
test_case.class_method_signature: KeysetHandleTest.testGetPublicKeysetHandle()
test_case.full_signature: @Test public void testGetPublicKeysetHandle()
test_case.identifier: testGetPublicKeysetHandle
test_case.invocations: generateNew getKeyData getKey getKeyset parseFrom getValue getEmptyRegistry getPublicKeysetHandle assertEquals getKeyCount getKeyset assertEquals getPrimaryKeyId getKeyset getPrimaryKeyId getKeyset getKeyData getKey getKeyset assertEquals getTypeUrl assertEquals getKeyMaterialType assertArrayEquals toByteArray getPublicKey toByteArray getValue getPrimitive getPrimitive randBytes verify sign fail
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetPublicKeysetHandle()
focal_class.declarator: keyset
focal_class.modifier: private final
focal_class.original_string: private final Keyset keyset;
focal_class.type: Keyset
focal_class.var_name: keyset
focal_class.file: java_src/src/main/java/com/google/crypto/tink/KeysetHandle.java
focal_class.identifier: KeysetHandle
focal_class.class_method_signature: KeysetHandle.KeysetHandle(Keyset keyset)
focal_class.full_signature: private  KeysetHandle(Keyset keyset)
focal_class.identifier: KeysetHandle
focal_class.modifiers: private
focal_class.parameters: (Keyset keyset)
focal_class.signature:  KeysetHandle(Keyset keyset)
focal_class.class_method_signature: KeysetHandle.fromKeyset(Keyset keyset)
focal_class.full_signature: static final KeysetHandle fromKeyset(Keyset keyset)
focal_class.identifier: fromKeyset
focal_class.modifiers: static final
focal_class.parameters: (Keyset keyset)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle fromKeyset(Keyset keyset)
focal_class.class_method_signature: KeysetHandle.getKeyset()
focal_class.full_signature:  Keyset getKeyset()
focal_class.identifier: getKeyset
focal_class.parameters: ()
focal_class.return: Keyset
focal_class.signature: Keyset getKeyset()
focal_class.class_method_signature: KeysetHandle.getKeysetInfo()
focal_class.full_signature: public KeysetInfo getKeysetInfo()
focal_class.identifier: getKeysetInfo
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: KeysetInfo
focal_class.signature: KeysetInfo getKeysetInfo()
focal_class.class_method_signature: KeysetHandle.generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate)
focal_class.full_signature: @Deprecated public static final KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate)
focal_class.identifier: generateNew
focal_class.modifiers: @Deprecated public static final
focal_class.parameters: (com.google.crypto.tink.proto.KeyTemplate keyTemplate)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle generateNew(com.google.crypto.tink.proto.KeyTemplate keyTemplate)
focal_class.class_method_signature: KeysetHandle.generateNew(KeyTemplate keyTemplate)
focal_class.full_signature: public static final KeysetHandle generateNew(KeyTemplate keyTemplate)
focal_class.identifier: generateNew
focal_class.modifiers: public static final
focal_class.parameters: (KeyTemplate keyTemplate)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle generateNew(KeyTemplate keyTemplate)
focal_class.class_method_signature: KeysetHandle.read(KeysetReader reader, Aead masterKey)
focal_class.full_signature: public static final KeysetHandle read(KeysetReader reader, Aead masterKey)
focal_class.identifier: read
focal_class.modifiers: public static final
focal_class.parameters: (KeysetReader reader, Aead masterKey)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle read(KeysetReader reader, Aead masterKey)
focal_class.class_method_signature: KeysetHandle.readNoSecret(KeysetReader reader)
focal_class.full_signature: public static final KeysetHandle readNoSecret(KeysetReader reader)
focal_class.identifier: readNoSecret
focal_class.modifiers: public static final
focal_class.parameters: (KeysetReader reader)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle readNoSecret(KeysetReader reader)
focal_class.class_method_signature: KeysetHandle.readNoSecret(final byte[] serialized)
focal_class.full_signature: public static final KeysetHandle readNoSecret(final byte[] serialized)
focal_class.identifier: readNoSecret
focal_class.modifiers: public static final
focal_class.parameters: (final byte[] serialized)
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle readNoSecret(final byte[] serialized)
focal_class.class_method_signature: KeysetHandle.write(KeysetWriter keysetWriter, Aead masterKey)
focal_class.full_signature: public void write(KeysetWriter keysetWriter, Aead masterKey)
focal_class.identifier: write
focal_class.modifiers: public
focal_class.parameters: (KeysetWriter keysetWriter, Aead masterKey)
focal_class.return: void
focal_class.signature: void write(KeysetWriter keysetWriter, Aead masterKey)
focal_class.class_method_signature: KeysetHandle.writeNoSecret(KeysetWriter writer)
focal_class.full_signature: public void writeNoSecret(KeysetWriter writer)
focal_class.identifier: writeNoSecret
focal_class.modifiers: public
focal_class.parameters: (KeysetWriter writer)
focal_class.return: void
focal_class.signature: void writeNoSecret(KeysetWriter writer)
focal_class.class_method_signature: KeysetHandle.encrypt(Keyset keyset, Aead masterKey)
focal_class.full_signature: private static EncryptedKeyset encrypt(Keyset keyset, Aead masterKey)
focal_class.identifier: encrypt
focal_class.modifiers: private static
focal_class.parameters: (Keyset keyset, Aead masterKey)
focal_class.return: EncryptedKeyset
focal_class.signature: EncryptedKeyset encrypt(Keyset keyset, Aead masterKey)
focal_class.class_method_signature: KeysetHandle.decrypt(EncryptedKeyset encryptedKeyset, Aead masterKey)
focal_class.full_signature: private static Keyset decrypt(EncryptedKeyset encryptedKeyset, Aead masterKey)
focal_class.identifier: decrypt
focal_class.modifiers: private static
focal_class.parameters: (EncryptedKeyset encryptedKeyset, Aead masterKey)
focal_class.return: Keyset
focal_class.signature: Keyset decrypt(EncryptedKeyset encryptedKeyset, Aead masterKey)
focal_class.class_method_signature: KeysetHandle.getPublicKeysetHandle()
focal_class.full_signature: public KeysetHandle getPublicKeysetHandle()
focal_class.identifier: getPublicKeysetHandle
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: KeysetHandle
focal_class.signature: KeysetHandle getPublicKeysetHandle()
focal_class.class_method_signature: KeysetHandle.createPublicKeyData(KeyData privateKeyData)
focal_class.full_signature: private static KeyData createPublicKeyData(KeyData privateKeyData)
focal_class.identifier: createPublicKeyData
focal_class.modifiers: private static
focal_class.parameters: (KeyData privateKeyData)
focal_class.return: KeyData
focal_class.signature: KeyData createPublicKeyData(KeyData privateKeyData)
focal_class.class_method_signature: KeysetHandle.validate(KeyData keyData)
focal_class.full_signature: @SuppressWarnings("deprecation") private static void validate(KeyData keyData)
focal_class.identifier: validate
focal_class.modifiers: @SuppressWarnings("deprecation") private static
focal_class.parameters: (KeyData keyData)
focal_class.return: void
focal_class.signature: void validate(KeyData keyData)
focal_class.class_method_signature: KeysetHandle.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: KeysetHandle.assertNoSecretKeyMaterial(Keyset keyset)
focal_class.full_signature: private static void assertNoSecretKeyMaterial(Keyset keyset)
focal_class.identifier: assertNoSecretKeyMaterial
focal_class.modifiers: private static
focal_class.parameters: (Keyset keyset)
focal_class.return: void
focal_class.signature: void assertNoSecretKeyMaterial(Keyset keyset)
focal_class.class_method_signature: KeysetHandle.assertEnoughKeyMaterial(Keyset keyset)
focal_class.full_signature: public static void assertEnoughKeyMaterial(Keyset keyset)
focal_class.identifier: assertEnoughKeyMaterial
focal_class.modifiers: public static
focal_class.parameters: (Keyset keyset)
focal_class.return: void
focal_class.signature: void assertEnoughKeyMaterial(Keyset keyset)
focal_class.class_method_signature: KeysetHandle.assertEnoughEncryptedKeyMaterial(EncryptedKeyset keyset)
focal_class.full_signature: public static void assertEnoughEncryptedKeyMaterial(EncryptedKeyset keyset)
focal_class.identifier: assertEnoughEncryptedKeyMaterial
focal_class.modifiers: public static
focal_class.parameters: (EncryptedKeyset keyset)
focal_class.return: void
focal_class.signature: void assertEnoughEncryptedKeyMaterial(EncryptedKeyset keyset)
focal_class.class_method_signature: KeysetHandle.getPrimitiveWithKnownInputPrimitive(
        Class<P> classObject, Class<B> inputPrimitiveClassObject)
focal_class.full_signature: private P getPrimitiveWithKnownInputPrimitive(
        Class<P> classObject, Class<B> inputPrimitiveClassObject)
focal_class.identifier: getPrimitiveWithKnownInputPrimitive
focal_class.modifiers: private
focal_class.parameters: (
        Class<P> classObject, Class<B> inputPrimitiveClassObject)
focal_class.return: P
focal_class.signature: P getPrimitiveWithKnownInputPrimitive(
        Class<P> classObject, Class<B> inputPrimitiveClassObject)
focal_class.class_method_signature: KeysetHandle.getPrimitive(Class<P> targetClassObject)
focal_class.full_signature: public P getPrimitive(Class<P> targetClassObject)
focal_class.identifier: getPrimitive
focal_class.modifiers: public
focal_class.parameters: (Class<P> targetClassObject)
focal_class.return: P
focal_class.signature: P getPrimitive(Class<P> targetClassObject)
focal_class.class_method_signature: KeysetHandle.getPrimitive(KeyManager<P> customKeyManager, Class<P> targetClassObject)
focal_class.full_signature: public P getPrimitive(KeyManager<P> customKeyManager, Class<P> targetClassObject)
focal_class.identifier: getPrimitive
focal_class.modifiers: public
focal_class.parameters: (KeyManager<P> customKeyManager, Class<P> targetClassObject)
focal_class.return: P
focal_class.signature: P getPrimitive(KeyManager<P> customKeyManager, Class<P> targetClassObject)
focal_method.body: public KeysetHandle getPublicKeysetHandle() throws GeneralSecurityException {
      if (keyset == null) {
        throw new GeneralSecurityException("cleartext keyset is not available");
      }
      Keyset.Builder keysetBuilder = Keyset.newBuilder();
      for (Keyset.Key key : keyset.getKeyList()) {
        KeyData keyData = createPublicKeyData(key.getKeyData());
        keysetBuilder.addKey(Keyset.Key.newBuilder().mergeFrom(key).setKeyData(keyData).build());
      }
      keysetBuilder.setPrimaryKeyId(keyset.getPrimaryKeyId());
      return new KeysetHandle(keysetBuilder.build());
    }
focal_method.class_method_signature: KeysetHandle.getPublicKeysetHandle()
focal_method.full_signature: public KeysetHandle getPublicKeysetHandle()
focal_method.identifier: getPublicKeysetHandle
focal_method.invocations: newBuilder getKeyList createPublicKeyData getKeyData addKey build setKeyData mergeFrom newBuilder setPrimaryKeyId getPrimaryKeyId build
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: KeysetHandle
focal_method.signature: KeysetHandle getPublicKeysetHandle()