Class PemObject
java.lang.Object
org.springframework.vault.support.PemObject
Represents a PEM object that is internally decoded to a DER object. Typically, used to
obtain a
RSAPrivateCrtKeySpec
.
Mainly for use within the framework.
- Since:
- 2.2
- Author:
- Mark Paluch
-
Method Summary
Modifier and TypeMethodDescriptionstatic PemObject
Create aPemObject
from PEMcontent
that is enclosed with-BEGIN PRIVATE KEY-
and-END PRIVATE KEY-
.Retrieve aX509Certificate
.Retrieve one or moreX509Certificate
s.Retrieve aRSAPrivateCrtKeySpec
.Retrieve aRSAPrivateCrtKeySpec
.boolean
static boolean
isPemEncoded
(String content) Check whether the content is PEM-encoded.boolean
boolean
Create one or morePemObject
s from PEMcontent
.static PemObject
parseFirst
(String content) Create aPemObject
from PEMcontent
that is enclosed with-BEGIN PRIVATE KEY-
or-BEGIN PUBLIC KEY-
.
-
Method Details
-
isPemEncoded
Check whether the content is PEM-encoded.- Parameters:
content
- the content to inspect- Returns:
true
if PEM-encoded.
-
fromKey
Create aPemObject
from PEMcontent
that is enclosed with-BEGIN PRIVATE KEY-
and-END PRIVATE KEY-
. This method returns either the first PEM object ot throwsIllegalArgumentException
of no object could be found.- Parameters:
content
- the PEM content.- Returns:
- the
PemObject
from PEMcontent
. - Throws:
IllegalArgumentException
- if no PEM object could be found.
-
parseFirst
Create aPemObject
from PEMcontent
that is enclosed with-BEGIN PRIVATE KEY-
or-BEGIN PUBLIC KEY-
. This method returns either the first PEM object ot throwsIllegalArgumentException
of no object could be found.- Parameters:
content
- the PEM content.- Returns:
- the
PemObject
from PEMcontent
. - Throws:
IllegalArgumentException
- if no PEM object could be found.- Since:
- 2.3
-
parse
Create one or morePemObject
s from PEMcontent
. Accepts concatenated PEM objects.- Parameters:
content
- the PEM content.- Returns:
- the list of
PemObject
from PEMcontent
. - Since:
- 2.3
-
isCertificate
public boolean isCertificate()- Returns:
- true if the object was identified to contain a private key.
- Since:
- 2.3
-
isPrivateKey
public boolean isPrivateKey()- Returns:
- true if the object was identified to contain a private key.
- Since:
- 2.3
-
isPublicKey
public boolean isPublicKey()- Returns:
- true if the object was identified to contain a public key.
- Since:
- 2.3
-
getCertificate
Retrieve aX509Certificate
.- Returns:
- the
X509Certificate
. - Since:
- 2.3
-
getCertificates
Retrieve one or moreX509Certificate
s.- Returns:
- the
X509Certificate
s. - Since:
- 2.4
-
getRSAPrivateKeySpec
Retrieve aRSAPrivateCrtKeySpec
.- Returns:
- the
RSAPrivateCrtKeySpec
. - Since:
- 2.3
-
getRSAPublicKeySpec
Retrieve aRSAPrivateCrtKeySpec
.- Returns:
- the
RSAPrivateCrtKeySpec
.
-