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 ECIKeyConverter.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPRIVATE_EC_KEY_ENDthe private EC key certificate endstatic java.lang.StringPRIVATE_EC_KEY_STARTthe private ECA key certificate startstatic java.lang.StringPUBLIC_EC_KEY_ENDthe public EC key endstatic java.lang.StringPUBLIC_EC_KEY_STARTthe public EC key start-
Fields inherited from class com.github.toolarium.security.pki.impl.AbstractKeyConverter
NL
-
-
Constructor Summary
Constructors Constructor Description ECKeyConverter()Constructor for ECConverterECKeyConverter(java.lang.String provider)Constructor for ECConverter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringformatPKCS8(java.lang.String content)Formats a raw base64 encoded PKCS8 to a well formed private key, which is bounded at the beginning by-----BEGIN ...java.lang.StringformatPublicKey(java.security.PublicKey publicKey)Formats a public key into a well formated X509 certificate (PEM format), which are each bounded at the beginning by-----BEGIN ...java.security.PublicKeygetPublicKey(byte[] content)Reads PKCS#8 formated public key from a buffer, which are each bounded at the beginning by-----BEGIN ...java.lang.StringnormalizePKCS8(java.lang.String content)Normalise a raw base64 encoded PKCS8 to a well formed private key.-
Methods inherited from class com.github.toolarium.security.pki.impl.AbstractKeyConverter
formatPrivateKey, generateKeyPair, generateKeyPair, getPrivateKey, getPrivateKey, getPrivateKey, getProvider, getPublicKey, getPublicKey, getType
-
-
-
-
Field Detail
-
PUBLIC_EC_KEY_START
public static final java.lang.String PUBLIC_EC_KEY_START
the public EC key start- See Also:
- Constant Field Values
-
PUBLIC_EC_KEY_END
public static final java.lang.String PUBLIC_EC_KEY_END
the public EC key end- See Also:
- Constant Field Values
-
PRIVATE_EC_KEY_START
public static final java.lang.String PRIVATE_EC_KEY_START
the private ECA key certificate start- See Also:
- Constant Field Values
-
PRIVATE_EC_KEY_END
public static final java.lang.String PRIVATE_EC_KEY_END
the private EC key certificate end- See Also:
- Constant Field Values
-
-
Method Detail
-
getPublicKey
public java.security.PublicKey getPublicKey(byte[] content) throws java.io.IOException, java.security.GeneralSecurityExceptionDescription copied from interface:IKeyConverterReads 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:
java.io.IOException- in case of errorjava.security.GeneralSecurityException- in case of error- See Also:
IKeyConverter.getPublicKey(byte[])
-
formatPublicKey
public java.lang.String formatPublicKey(java.security.PublicKey publicKey)
Description copied from interface:IKeyConverterFormats 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:
IKeyConverter.formatPublicKey(java.security.PublicKey)
-
formatPKCS8
public java.lang.String formatPKCS8(java.lang.String content)
Description copied from interface:IKeyConverterFormats 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:
IKeyConverter.formatPKCS8(java.lang.String)
-
normalizePKCS8
public java.lang.String normalizePKCS8(java.lang.String content)
Description copied from interface:IKeyConverterNormalise 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:
IKeyConverter.normalizePKCS8(java.lang.String)
-
-