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 PemObjectCreate aPemObjectfrom PEMcontentthat is enclosed with-BEGIN PRIVATE KEY-and-END PRIVATE KEY-.Retrieve aX509Certificate.Retrieve one or moreX509Certificates.Retrieve aRSAPrivateCrtKeySpec.Retrieve aRSAPrivateCrtKeySpec.booleanstatic booleanisPemEncoded(String content) Check whether the content is PEM-encoded.booleanbooleanCreate one or morePemObjects from PEMcontent.static PemObjectparseFirst(String content) Create aPemObjectfrom PEMcontentthat 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:
trueif PEM-encoded.
-
fromKey
Create aPemObjectfrom PEMcontentthat is enclosed with-BEGIN PRIVATE KEY-and-END PRIVATE KEY-. This method returns either the first PEM object ot throwsIllegalArgumentExceptionof no object could be found.- Parameters:
content- the PEM content.- Returns:
- the
PemObjectfrom PEMcontent. - Throws:
IllegalArgumentException- if no PEM object could be found.
-
parseFirst
Create aPemObjectfrom PEMcontentthat is enclosed with-BEGIN PRIVATE KEY-or-BEGIN PUBLIC KEY-. This method returns either the first PEM object ot throwsIllegalArgumentExceptionof no object could be found.- Parameters:
content- the PEM content.- Returns:
- the
PemObjectfrom PEMcontent. - Throws:
IllegalArgumentException- if no PEM object could be found.- Since:
- 2.3
-
parse
Create one or morePemObjects from PEMcontent. Accepts concatenated PEM objects.- Parameters:
content- the PEM content.- Returns:
- the list of
PemObjectfrom 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 moreX509Certificates.- Returns:
- the
X509Certificates. - Since:
- 2.4
-
getRSAPrivateKeySpec
Retrieve aRSAPrivateCrtKeySpec.- Returns:
- the
RSAPrivateCrtKeySpec. - Since:
- 2.3
-
getRSAPublicKeySpec
Retrieve aRSAPrivateCrtKeySpec.- Returns:
- the
RSAPrivateCrtKeySpec.
-