Skip to content

Commit e0d6996

Browse files
navinaTimurSadykov
andauthored
feat: Add ability to provide PrivateKey as Pkcs8 encoded string #883 (#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 <[email protected]>
1 parent f04cf11 commit e0d6996

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,11 @@ public Builder setPrivateKey(PrivateKey privateKey) {
10521052
return this;
10531053
}
10541054

1055+
public Builder setPrivateKeyString(String privateKeyPkcs8) throws IOException {
1056+
this.privateKey = privateKeyFromPkcs8(privateKeyPkcs8);
1057+
return this;
1058+
}
1059+
10551060
public Builder setPrivateKeyId(String privateKeyId) {
10561061
this.privateKeyId = privateKeyId;
10571062
return this;

0 commit comments

Comments
 (0)