Class ECKeyConverter

java.lang.Object
com.github.toolarium.security.pki.impl.AbstractKeyConverter
com.github.toolarium.security.pki.impl.ECKeyConverter
All Implemented Interfaces:
IKeyConverter

public class ECKeyConverter extends AbstractKeyConverter
Implements the EC IKeyConverter.
  • Field Details

  • Constructor Details

    • ECKeyConverter

      public ECKeyConverter()
      Constructor for ECConverter
    • ECKeyConverter

      public ECKeyConverter(String provider)
      Constructor for ECConverter
      Parameters:
      provider - the provider or null to use default provider
  • Method Details

    • getPublicKey

      public PublicKey getPublicKey(byte[] content) throws IOException, GeneralSecurityException
      Description copied from interface: IKeyConverter
      Reads PKCS#8 formated public key from a buffer, which are each bounded at the beginning by -----BEGIN ... PUBLIC KEY-----, and bounded at the end by -----END ... PUBLIC KEY-----.
      Parameters:
      content - the data
      Returns:
      the public key
      Throws:
      IOException - in case of error
      GeneralSecurityException - in case of error
      See Also:
    • formatPublicKey

      public String formatPublicKey(PublicKey publicKey)
      Description copied from interface: IKeyConverter
      Formats a public key into a well formated X509 certificate (PEM format), which are each bounded at the beginning by -----BEGIN ... PUBLIC KEY-----, and bounded at the end by -----END ... PUBLIC KEY-----.
      Parameters:
      publicKey - the public key to format
      Returns:
      the well formed certificate
      See Also:
    • formatPKCS8

      public String formatPKCS8(String content)
      Description copied from interface: IKeyConverter
      Formats a raw base64 encoded PKCS8 to a well formed private key, which is bounded at the beginning by -----BEGIN ... PRIVATE KEY-----, and bounded at the end by -----END ... PRIVATE KEY-----.
      Parameters:
      content - the raw data to format
      Returns:
      the well formed certificate
      See Also:
    • normalizePKCS8

      public String normalizePKCS8(String content)
      Description copied from interface: IKeyConverter
      Normalise a raw base64 encoded PKCS8 to a well formed private key.
      Parameters:
      content - the raw data to normalise
      Returns:
      the normalised private key
      See Also: