public static void createKeyset(
      OutputStream outputStream,
      String outFormat,
      String masterKeyUri,
      String credentialPath,
      KeyTemplate keyTemplate)
      throws GeneralSecurityException, IOException {
    KeysetHandle handle = KeysetHandle.generateNew(keyTemplate);

    writeKeyset(handle, outputStream, outFormat, masterKeyUri, credentialPath);
  }
Creates a keyset that contains a single key of template {@code keyTemplate}, encrypts it using
{@code credentialPath} and {@code masterKeyUri}, then writes it to {@code writer}.
tools/tinkey/src/main/java/com/google/crypto/tink/tinkey/TinkeyUtil.java