Skip to content

Commit

Permalink
feat: Make it easy to convert a Pkcs8 encoded string to PrivateKey #883
Browse files Browse the repository at this point in the history
This change adds a new method `setPrivateKeyString` in `ServiceAccountCredentials.Builder` to accept Pkcs8 encoded string representation of private keys.
  • Loading branch information
navina committed Mar 10, 2022
1 parent d941364 commit 3f4fd3b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,12 @@ 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 3f4fd3b

Please sign in to comment.