Package com.google.auth.oauth2
Class OAuth2Utils
java.lang.Object
com.google.auth.oauth2.OAuth2Utils
Internal utilities for the com.google.auth.oauth2 namespace.
These classes are marked public but should be treated effectively as internal classes only.
They are not subject to any backwards compatibility guarantees and might change or be removed at
any time. They are provided only as a convenience for other libraries within the
com.google.auth family. Application developers should avoid using these classes directly; they
are not part of the public API.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final HttpTransportFactorystatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionstatic PrivateKeyprivateKeyFromPkcs8(String privateKeyPkcs8) Converts a PKCS#8 string to an RSA private key.static PrivateKeyprivateKeyFromPkcs8(String privateKeyPkcs8, com.google.auth.oauth2.OAuth2Utils.Pkcs8Algorithm algorithm) Reads a private key from a PKCS#8 encoded string.
-
Field Details
-
TOKEN_TYPE_ACCESS_TOKEN
- See Also:
-
TOKEN_TYPE_ACCESS_BOUNDARY_INTERMEDIARY_TOKEN
- See Also:
-
TOKEN_EXCHANGE_URL_FORMAT
- See Also:
-
CLOUD_PLATFORM_SCOPE
- See Also:
-
HTTP_TRANSPORT_FACTORY
-
TOKEN_ENDPOINT_RETRYABLE_STATUS_CODES
-
-
Method Details
-
privateKeyFromPkcs8
Converts a PKCS#8 string to an RSA private key.- Parameters:
privateKeyPkcs8- the PKCS#8 string.- Returns:
- the RSA private key.
- Throws:
IOException- if the PKCS#8 data is invalid or if an unexpected exception occurs during key creation.
-
privateKeyFromPkcs8
public static PrivateKey privateKeyFromPkcs8(String privateKeyPkcs8, com.google.auth.oauth2.OAuth2Utils.Pkcs8Algorithm algorithm) throws IOException Reads a private key from a PKCS#8 encoded string.If the key is labeled with "-----BEGIN PRIVATE KEY-----", it is parsed as PKCS#8 as per RFC 7468 Section 10.
- Parameters:
privateKeyPkcs8- base64 encoded private key stringalgorithm- expected algorithm of the private key- Returns:
- the private key.
- Throws:
IOException- if the private key data is invalid or if an unexpected exception occurs during key creation.- See Also:
-