Package org.springframework.boot.ssl.pem
Class PemContent
java.lang.Object
org.springframework.boot.ssl.pem.PemContent
PEM encoded content that can provide
certificates
and
private keys
.- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Parse and return allcertificates
from the PEM content.Parse and return theprivate keys
from the PEM content.getPrivateKey
(String password) Parse and return theprivate keys
from the PEM content ornull
if there is no private key.int
hashCode()
static boolean
isPresentInText
(String text) Return if PEM content is present in the given text.static PemContent
LoadPemContent
from the givenPath
.static PemContent
Return a newPemContent
instance containing the given text.toString()
-
Method Details
-
getCertificates
Parse and return allcertificates
from the PEM content. Most PEM files either contain a single certificate or a certificate chain.- Returns:
- the certificates
- Throws:
IllegalStateException
- if no certificates could be loaded
-
getPrivateKey
Parse and return theprivate keys
from the PEM content.- Returns:
- the private keys
- Throws:
IllegalStateException
- if no private key could be loaded
-
getPrivateKey
Parse and return theprivate keys
from the PEM content ornull
if there is no private key.- Parameters:
password
- the password to decrypt the private keys ornull
- Returns:
- the private keys
-
equals
-
hashCode
public int hashCode() -
toString
-
load
LoadPemContent
from the givenPath
.- Parameters:
path
- a path to load the content from- Returns:
- the loaded PEM content
- Throws:
IOException
- on IO error
-
of
Return a newPemContent
instance containing the given text.- Parameters:
text
- the text containing PEM encoded content- Returns:
- a new
PemContent
instance
-
isPresentInText
Return if PEM content is present in the given text.- Parameters:
text
- the text to check- Returns:
- if the text includes PEM encoded content.
-