Package com.oracle.bmc.auth.internal
Class AuthUtils
- java.lang.Object
- 
- com.oracle.bmc.auth.internal.AuthUtils
 
- 
 public class AuthUtils extends Object Utilities dealing with authorization.
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]base64Decode(String base64)Decode the base64 string.static Stringbase64EncodeNoChunking(X509Certificate certificate)Base64 encodes a X509Certificate with no chunking.static Stringbase64EncodeNoChunking(RSAPublicKey publicKey)Base64 encodes a public key with no chunking.static StringgetFingerPrint(X509Certificate certificate)Gets the fingerprint of a certificate using Sha256.static StringgetTenantIdFromCertificate(X509Certificate certificate)Get the tenant id from the given certificate.static byte[]toByteArrayFromRSAPrivateKey(RSAPrivateKey key)Converts a private key back to a PEM formatted input stream.static Optional<JWK>toJwk(String json)Convert JSON string intoJWK.static Optional<RSAPublicKey>toPublicKeyFromJson(String json)Convert JWK JSON string into aRSAPublicKey.static Optional<RSAPublicKey>toPublicKeyFromJwk(JWK jwk)ConvertJWKintoRSAPublicKey.
 
- 
- 
- 
Method Detail- 
getFingerPrintpublic static String getFingerPrint(X509Certificate certificate) Gets the fingerprint of a certificate using Sha256.This is the same value that you would get by running, openssl x509 -in certificate.pem -noout -fingerprint- Parameters:
- certificate- the certificate
- Returns:
- Fingerprint of the certificate
- Throws:
- Error- if there is an error
 
 - 
toPublicKeyFromJsonpublic static Optional<RSAPublicKey> toPublicKeyFromJson(String json) Convert JWK JSON string into aRSAPublicKey.- Returns:
 
 - 
toJwkpublic static Optional<JWK> toJwk(String json) Convert JSON string intoJWK.- Parameters:
- json- the json string
- Returns:
- Optional of JWK
 
 - 
toPublicKeyFromJwkpublic static Optional<RSAPublicKey> toPublicKeyFromJwk(JWK jwk) ConvertJWKintoRSAPublicKey.- Parameters:
- jwk- the jwk object
- Returns:
- Optional of RSAPublicKey
 
 - 
toByteArrayFromRSAPrivateKeypublic static byte[] toByteArrayFromRSAPrivateKey(RSAPrivateKey key) Converts a private key back to a PEM formatted input stream.- Parameters:
- key- The key to convert.
- Returns:
- A new input stream
 
 - 
base64EncodeNoChunkingpublic static String base64EncodeNoChunking(RSAPublicKey publicKey) Base64 encodes a public key with no chunking.- Parameters:
- publicKey- The public key
- Returns:
- Base64 representation
 
 - 
base64EncodeNoChunkingpublic static String base64EncodeNoChunking(X509Certificate certificate) throws CertificateEncodingException Base64 encodes a X509Certificate with no chunking.- Parameters:
- certificate- The certificate
- Returns:
- Base64 representation
- Throws:
- CertificateEncodingException
 
 - 
base64Decodepublic static byte[] base64Decode(String base64) Decode the base64 string.This supports both ‘+’ and ‘/’ as well as ‘-’ and ‘_’. - Parameters:
- base64- base64 string
- Returns:
- decoded bytes
 
 - 
getTenantIdFromCertificatepublic static String getTenantIdFromCertificate(X509Certificate certificate) Get the tenant id from the given certificate.- Parameters:
- certificate- the given certificate.
- Returns:
- the tenant id.
 
 
- 
 
-