Interface CryptoKeyPairUtility
- All Known Implementing Classes:
StandardCryptoKeyPairUtility
public interface CryptoKeyPairUtility
Utility functions for crypto keys.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongenerateKeyPair(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm) Generates a key pair (public and private) as anEncodedKeyPair.default PrivateKeygetPrivateKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation) Loads the private key from the supplied base64 string.<PrivateKeyT extends PrivateKey>
PrivateKeyTgetPrivateKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation, Class<PrivateKeyT> publicKeyTClass) Loads the private key from the supplied base64 encoded string.default PublicKeygetPublicKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation) Loads the public key from the supplied base64 string.<PublicKeyT extends PublicKey>
PublicKeyTgetPublicKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation, Class<PublicKeyT> publicKeyTClass) Loads the public key from the supplied base64 encoded string.
-
Field Details
-
RSA_ALGO
The RSA Algorithm.- See Also:
-
ECDSA_ALGO
The Elliptic Curve Algorithm.- See Also:
-
-
Method Details
-
generateKeyPair
Generates a key pair (public and private) as anEncodedKeyPair.- Parameters:
privateKeyCrytpoAlgorithm- thePrivateKeyCrytpoAlgorithmto use.- Returns:
- the
EncodedKeyPairincluding both public and private key.
-
getPublicKey
default PublicKey getPublicKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation) throws InvalidKeyException Loads the public key from the supplied base64 string.- Parameters:
privateKeyCrytpoAlgorithm- the algorithmbase64Representation- the base64 representation- Returns:
- the
PublicKey - Throws:
InvalidKeyException
-
getPublicKey
<PublicKeyT extends PublicKey> PublicKeyT getPublicKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation, Class<PublicKeyT> publicKeyTClass) throws InvalidKeyException Loads the public key from the supplied base64 encoded string.- Type Parameters:
PublicKeyT- the requested type- Parameters:
privateKeyCrytpoAlgorithm- the auth scheme algorithmbase64Representation- the base64 encoded public keypublicKeyTClass- the public key class- Returns:
- the public key
- Throws:
InvalidKeyException
-
getPrivateKey
default PrivateKey getPrivateKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation) throws InvalidKeyException Loads the private key from the supplied base64 string.- Parameters:
privateKeyCrytpoAlgorithm- the algorithmbase64Representation- the base64 representation- Returns:
- the
PublicKey - Throws:
InvalidKeyException
-
getPrivateKey
<PrivateKeyT extends PrivateKey> PrivateKeyT getPrivateKey(PrivateKeyCrytpoAlgorithm privateKeyCrytpoAlgorithm, String base64Representation, Class<PrivateKeyT> publicKeyTClass) throws InvalidKeyException Loads the private key from the supplied base64 encoded string.- Type Parameters:
PrivateKeyT- the requested type- Parameters:
privateKeyCrytpoAlgorithm- the auth scheme algorithmbase64Representation- the base64 encoded public keypublicKeyTClass- the public key class- Returns:
- the
PrivateKey - Throws:
InvalidKeyException
-