Package com.bld.crypto.commons
Class KeyUtility
java.lang.Object
com.bld.crypto.commons.KeyUtility
Utility class that provides static helper methods for converting raw key material
(Base64-encoded DER bytes) into
PublicKey instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PublicKeygetPublicKey(String publicKey, InstanceType instanceType) Decodes a Base64-encoded X.509 public key and returns aPublicKeyfor the specified algorithm.
-
Constructor Details
-
KeyUtility
public KeyUtility()
-
-
Method Details
-
getPublicKey
Decodes a Base64-encoded X.509 public key and returns aPublicKeyfor the specified algorithm.- Parameters:
publicKey- the Base64-encoded DER representation of the public key; returnsnullif blankinstanceType- the algorithm used to build the key factory (e.g. RSA, EC)- Returns:
- the decoded
PublicKey, ornullifpublicKeyis blank - Throws:
CryptoException- if the algorithm is not available or the key spec is invalid
-