@CanIgnoreReturnValue
  public KmsClient withCredentials(GoogleCredentials credentials) throws GeneralSecurityException {
    if (credentials.createScopedRequired()) {
      credentials = credentials.createScoped(CloudKMSScopes.all());
    }
    try {
      this.cloudKms =
          new CloudKMS.Builder(
                  GoogleNetHttpTransport.newTrustedTransport(),
                  new GsonFactory(),
                  new HttpCredentialsAdapter(credentials))
              .setApplicationName(APPLICATION_NAME)
              .build();
    } catch (IOException e) {
      throw new GeneralSecurityException("cannot build GCP KMS client", e);
    }
    return this;
  }
Loads the provided credentials with {@code GoogleCredentials}.
java_src/src/main/java/com/google/crypto/tink/integration/gcpkms/GcpKmsClient.java