Skip to content

Commit

Permalink
feat: Add ability to provide PrivateKey as Pkcs8 encoded string #883 (#…
Browse files Browse the repository at this point in the history
…889)

* feat: Add ability to provide PrivateKey as Pkcs8 encoded string #883

This change adds a new method `setPrivateKeyString` in `ServiceAccountCredentials.Builder` to accept Pkcs8 encoded string representation of private keys.

Co-authored-by: Timur Sadykov <stim@google.com>
  • Loading branch information
navina and TimurSadykov committed Mar 28, 2022
1 parent f04cf11 commit e0d6996
Showing 1 changed file with 5 additions and 0 deletions.
Expand Up @@ -1052,6 +1052,11 @@ public Builder setPrivateKey(PrivateKey privateKey) {
return this;
}

public Builder setPrivateKeyString(String privateKeyPkcs8) throws IOException {
this.privateKey = privateKeyFromPkcs8(privateKeyPkcs8);
return this;
}

public Builder setPrivateKeyId(String privateKeyId) {
this.privateKeyId = privateKeyId;
return this;
Expand Down

0 comments on commit e0d6996

Please sign in to comment.