Class RSAKeyConverter
java.lang.Object
com.github.toolarium.security.pki.impl.AbstractKeyConverter
com.github.toolarium.security.pki.impl.RSAKeyConverter
- All Implemented Interfaces:
IKeyConverter
Implements the RSA
IKeyConverter.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe private RSA key certificate endstatic final Stringthe private RSA key certificate startstatic final Stringthe public DSA key endstatic final Stringthe public RSA key endstatic final Stringthe public RSA key startFields inherited from class com.github.toolarium.security.pki.impl.AbstractKeyConverter
NL -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for RSAConverterRSAKeyConverter(String provider) Constructor for RSAConverter -
Method Summary
Modifier and TypeMethodDescriptionformatPKCS8(String content) Formats a raw base64 encoded PKCS8 to a well formed private key, which is bounded at the beginning by-----BEGIN ...formatPublicKey(PublicKey publicKey) Formats a public key into a well formated X509 certificate (PEM format), which are each bounded at the beginning by-----BEGIN ...getPrivateKey(String content) Reads PKCS#8 formated private key from a buffer, which are each bounded at the beginning by-----BEGIN ...getPublicKey(byte[] content) Reads PKCS#8 formated public key from a buffer, which are each bounded at the beginning by-----BEGIN ...normalizePKCS8(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, getProvider, getPublicKey, getPublicKey, getType
-
Field Details
-
PUBLIC_RSA_KEY_START
the public RSA key start- See Also:
-
PUBLIC_RSA_KEY_END
the public RSA key end- See Also:
-
PUBLIC_DSA_KEY_END
the public DSA key end- See Also:
-
PRIVATE_RSA_KEY_START
the private RSA key certificate start- See Also:
-
PRIVATE_RSA_KEY_END
the private RSA key certificate end- See Also:
-
-
Constructor Details
-
RSAKeyConverter
public RSAKeyConverter()Constructor for RSAConverter -
RSAKeyConverter
Constructor for RSAConverter- Parameters:
provider- the provider or null to use default provider
-
-
Method Details
-
getPublicKey
Description 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:
IOException- in case of errorGeneralSecurityException- in case of error- See Also:
-
getPrivateKey
Description copied from interface:IKeyConverterReads PKCS#8 formated private key from a buffer, which are each bounded at the beginning by-----BEGIN ... PRIVATE KEY-----, and bounded at the end by-----END ... PRIVATE KEY-----.- Specified by:
getPrivateKeyin interfaceIKeyConverter- Overrides:
getPrivateKeyin classAbstractKeyConverter- Parameters:
content- the private key to encode- Returns:
- the private key
- Throws:
GeneralSecurityException- in case of error- See Also:
-
formatPublicKey
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:
-
formatPKCS8
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:
-
normalizePKCS8
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:
-