Class KeyLoader
java.lang.Object
com.mastercard.developer.oauth2.keys.KeyLoader
Utility class for loading keys.
-
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPairloadKeyPair(InputStream jwkInputStream) Loads a key pair from a JWK input stream.static KeyPairloadKeyPair(Path jwkFilePath) Loads a key pair from a JWK file.static PrivateKeyloadPrivateKey(InputStream keyDataStream) Loads a private key from an input stream.static PrivateKeyloadPrivateKey(InputStream pkcs12KeyInputStream, String signingKeyAlias, String signingKeyPassword) Loads a private key from a PKCS12 keystore input stream.static PrivateKeyloadPrivateKey(String pkcs12KeyFilePath, String decryptionKeyAlias, String decryptionKeyPassword) Loads a private key from a PKCS12 keystore file.static PrivateKeyloadPrivateKey(Path keyFilePath) Loads a private key from a file.
-
Method Details
-
loadPrivateKey
public static PrivateKey loadPrivateKey(Path keyFilePath) throws GeneralSecurityException, IOException Loads a private key from a file. Supports PKCS1 PEM, PKCS8 PEM, and PKCS8 DER formats.- Throws:
GeneralSecurityExceptionIOException
-
loadPrivateKey
public static PrivateKey loadPrivateKey(InputStream keyDataStream) throws GeneralSecurityException, IOException Loads a private key from an input stream. Supports PKCS1 PEM, PKCS8 PEM, and PKCS8 DER formats.- Throws:
GeneralSecurityExceptionIOException
-
loadPrivateKey
public static PrivateKey loadPrivateKey(String pkcs12KeyFilePath, String decryptionKeyAlias, String decryptionKeyPassword) throws GeneralSecurityException, IOException Loads a private key from a PKCS12 keystore file.- Throws:
GeneralSecurityExceptionIOException
-
loadPrivateKey
public static PrivateKey loadPrivateKey(InputStream pkcs12KeyInputStream, String signingKeyAlias, String signingKeyPassword) throws IOException, KeyStoreException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException Loads a private key from a PKCS12 keystore input stream. -
loadKeyPair
Loads a key pair from a JWK file.- Throws:
IOException
-
loadKeyPair
Loads a key pair from a JWK input stream.- Throws:
IOException
-