public static KeyData createKeyData(MessageLite key, String typeUrl, KeyData.KeyMaterialType type)
      throws Exception {
    return KeyData.newBuilder()
        .setValue(key.toByteString())
        .setTypeUrl(typeUrl)
        .setKeyMaterialType(type)
        .build();
  }
@return a {@code KeyData} from a specified key.
java_src/src/main/java/com/google/crypto/tink/testing/TestUtil.java