Class KeyUtility

java.lang.Object
com.bld.crypto.commons.KeyUtility

public class KeyUtility extends Object
Utility class that provides static helper methods for converting raw key material (Base64-encoded DER bytes) into PublicKey instances.
  • Constructor Details

    • KeyUtility

      public KeyUtility()
  • Method Details

    • getPublicKey

      public static PublicKey getPublicKey(String publicKey, InstanceType instanceType)
      Decodes a Base64-encoded X.509 public key and returns a PublicKey for the specified algorithm.
      Parameters:
      publicKey - the Base64-encoded DER representation of the public key; returns null if blank
      instanceType - the algorithm used to build the key factory (e.g. RSA, EC)
      Returns:
      the decoded PublicKey, or null if publicKey is blank
      Throws:
      CryptoException - if the algorithm is not available or the key spec is invalid