Conversation
| return (Integer) value; | ||
| } | ||
|
|
||
| private static String signUsingEsSha256( |
There was a problem hiding this comment.
there is a lot of logic in here. Can we add some documentation here (comments or a link to the algorithm) and would it be possible to add tests for this method?
There was a problem hiding this comment.
Added comments and tests for this method and the helper right below.
| * @throws IOException if the PKCS#8 data is invalid or if an unexpected exception occurs during | ||
| * key creation. | ||
| */ | ||
| public static PrivateKey privateKeyFromPkcs8(String privateKeyPkcs8, String algorithm) |
There was a problem hiding this comment.
Since this is a public method, what happens if a user calls this with an algorithm that doens't exist?
thoughts on this: can we have the second algorithm be an enum where the two options are RSA or EC so that users can't mistakenly put the wrong algorithm?
There was a problem hiding this comment.
https://github.com/googleapis/google-auth-library-java/pull/1896/changes#r2949462487 I think we don't really want to support more than just EC.
There was a problem hiding this comment.
Yes you're right. can this method be package-private? And can we have a check to restrict this so that only EC algorithm is supported/ valid
There was a problem hiding this comment.
A mistake of mine: I thought this was GdchCredentials. Yes this public utils class is better suited to an enum.
|


Context: b/488439640
Implementation originally proposed in b/431924643#comment9
The primary objective is to enable support for Elliptic Curve (EC) keys and non-URI audience formats, aligning the Java SDK with the behavior of the Python and Go implementations. Additionally, the GDCH key creation tool creates EC keys only, meaning the GDCH implementation was not following the convention.
Key Changes
apiAudiencefield from aURIto aStringto accommodate "magic" non-URI strings (e.g., specific administrative audiences) required by certain GDCH services.privateKeyFromPkcs8to accept an algorithm parameter, allowing the library to parse EC keys instead of defaulting exclusively to RSA.Testing
GdchCredentialsTestto include test cases for EC key parsing and token signing.