@CanIgnoreReturnValue
  @Deprecated
  public synchronized KeysetManager add(KeyHandle keyHandle)
      throws GeneralSecurityException {
    ProtoKey pkey;
    try {
      pkey = (ProtoKey) keyHandle.getKey(SecretKeyAccess.insecureSecretAccess());
    } catch (ClassCastException e) {
      throw new UnsupportedOperationException(
          "KeyHandles which contain TinkKeys that are not ProtoKeys are not yet supported.", e);
    }

    if (keyIdExists(keyHandle.getId())) {
      throw new GeneralSecurityException(
          "Trying to add a key with an ID already contained in the keyset.");
    }

    keysetBuilder.addKey(
        Keyset.Key.newBuilder()
            .setKeyData(pkey.getProtoKey())
            .setKeyId(keyHandle.getId())
            .setStatus(KeyStatusTypeProtoConverter.toProto(keyHandle.getStatus()))
            .setOutputPrefixType(KeyTemplate.toProto(pkey.getOutputPrefixType()))
            .build());
    return this;
  }
Adds the input {@link KeyHandle} to the existing keyset. The KeyStatusType and key ID of the
{@link KeyHandle} are used as-is in the keyset.

@throws UnsupportedOperationException if the {@link KeyHandle} contains a {@link TinkKey} which
    is not a {@link ProtoKey}.
@throws GeneralSecurityException if the {@link KeyHandle}'s key ID collides with another key ID
    in the keyset.
@deprecated We recommend to use the {@code KeysetHandle.Builder} API.
java_src/src/main/java/com/google/crypto/tink/KeysetManager.java