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
- Author:
- Scott Frederick, Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptionbooleanParse and return allcertificatesfrom the PEM content.Parse and return theprivate keysfrom the PEM content.getPrivateKey(String password) Parse and return theprivate keysfrom the PEM content ornullif there is no private key.inthashCode()static booleanisPresentInText(String text) Return if PEM content is present in the given text.static PemContentLoadPemContentfrom the givenPath.static 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
public int 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
-
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.
-