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
- Author:
- Scott Frederick, Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionbooleanParse and return allcertificatesfrom the PEM content.@Nullable PrivateKeyParse and return theprivate keysfrom the PEM content.@Nullable PrivateKeygetPrivateKey(@Nullable String password) Parse and return theprivate keysfrom the PEM content ornullif there is no private key.inthashCode()static booleanisPresentInText(@Nullable String text) Return if PEM content is present in the given text.static PemContentload(InputStream in) LoadPemContentfrom the givenInputStream.static PemContentLoadPemContentfrom the givenPath.static @Nullable PemContentReturn a newPemContentinstance containing the given text.toString()
-
Method Details
-
getCertificates
Parse and return allcertificatesfrom 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 keysfrom the PEM content.- Returns:
- the private keys
- Throws:
IllegalStateException- if no private key could be loaded
-
getPrivateKey
Parse and return theprivate keysfrom the PEM content ornullif there is no private key.- Parameters:
password- the password to decrypt the private keys ornull- Returns:
- the private keys
-
equals
-
hashCode
-
toString
-
load
LoadPemContentfrom the givenPath.- Parameters:
path- a path to load the content from- Returns:
- the loaded PEM content
- Throws:
IOException- on IO error
-
load
LoadPemContentfrom the givenInputStream.- Parameters:
in- an input stream to load the content from- Returns:
- the loaded PEM content
- Throws:
IOException- on IO error
-
of
Return a newPemContentinstance containing the given text.- Parameters:
text- the text containing PEM encoded content- Returns:
- a new
PemContentinstance
-
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.
-