Package codes.grow.packages.vault
Class Pki
java.lang.Object
codes.grow.packages.vault.Pki
PKI engine on one mount:
client.pki() (mount pki).
IssuedCertificate cert = client.pki().issueCertificate("web", "app.example.test");
-
Method Summary
Modifier and TypeMethodDescriptionissueCertificate(String role, String commonName) Issues a certificate and private key for a role.issueCertificate(String role, String commonName, IssueOptions options) Issues a certificate and private key:POST <mount>/issue/<role>.issueCertificateAsync(String role, String commonName, IssueOptions o) AsynchronousissueCertificate(String, String, IssueOptions).Serials of all stored certificates; empty when there is none.AsynchronouslistCertificates().mount()Returns the mount.The CA chain as PEM text (GET <mount>/ca_chain, raw PEM).AsynchronousreadCaChain().readCertificate(String serial) A certificate by serial;NotFoundExceptionwhen unknown.readCertificateAsync(String serial) AsynchronousreadCertificate(String).revokeCertificate(String serial) Revokes a certificate by serial (aa:bb:...); unknown serials raiseValidationException.revokeCertificateAsync(String serial) AsynchronousrevokeCertificate(String).Signs a PEM CSR for a role.signCsr(String role, String csr, IssueOptions options) Signs a PEM CSR:POST <mount>/sign/<role>.signCsrAsync(String role, String csr, IssueOptions o) AsynchronoussignCsr(String, String, IssueOptions).tidy()Starts a tidy run and waits until it is done (defaults).tidy(TidyOptions options) Starts a tidy run (POST <mount>/tidy, 202) and, unlessawait(false), pollstidy-statusuntil it isFinished,ErrororCancelled.Asynchronoustidy(TidyOptions).Current tidy progress:GET <mount>/tidy-status.AsynchronoustidyStatus().toString()
-
Method Details
-
mount
Returns the mount.- Returns:
- the mount path
-
issueCertificate
Issues a certificate and private key for a role.- Parameters:
role- role namecommonName- common name- Returns:
- the certificate and key
-
issueCertificate
Issues a certificate and private key:POST <mount>/issue/<role>. A name the role does not allow raisesValidationException.- Parameters:
role- role namecommonName- common nameoptions- SANs, TTL, format- Returns:
- the certificate and key
-
issueCertificateAsync
public CompletableFuture<IssuedCertificate> issueCertificateAsync(String role, String commonName, IssueOptions o) AsynchronousissueCertificate(String, String, IssueOptions).- Parameters:
role- role namecommonName- common nameo- options- Returns:
- a future with the certificate and key
-
signCsr
Signs a PEM CSR for a role.- Parameters:
role- role namecsr- PEM certificate signing request- Returns:
- the certificate
-
signCsr
Signs a PEM CSR:POST <mount>/sign/<role>. Invalid CSRs raiseValidationException.- Parameters:
role- role namecsr- PEM CSRoptions- common name, SANs, TTL, format- Returns:
- the certificate
-
signCsrAsync
AsynchronoussignCsr(String, String, IssueOptions).- Parameters:
role- role namecsr- PEM CSRo- options- Returns:
- a future with the certificate
-
revokeCertificate
Revokes a certificate by serial (aa:bb:...); unknown serials raiseValidationException.- Parameters:
serial- serial number- Returns:
- the revocation info
-
revokeCertificateAsync
AsynchronousrevokeCertificate(String).- Parameters:
serial- serial number- Returns:
- a future with the revocation info
-
readCaChain
The CA chain as PEM text (GET <mount>/ca_chain, raw PEM).- Returns:
- PEM text
-
readCaChainAsync
AsynchronousreadCaChain().- Returns:
- a future with the PEM text
-
readCertificate
A certificate by serial;NotFoundExceptionwhen unknown.- Parameters:
serial- serial number- Returns:
- the certificate
-
readCertificateAsync
AsynchronousreadCertificate(String).- Parameters:
serial- serial number- Returns:
- a future with the certificate
-
listCertificates
Serials of all stored certificates; empty when there is none.- Returns:
- the serials
-
listCertificatesAsync
AsynchronouslistCertificates().- Returns:
- a future with the serials
-
tidyStatus
Current tidy progress:GET <mount>/tidy-status.- Returns:
- the status
-
tidyStatusAsync
AsynchronoustidyStatus().- Returns:
- a future with the status
-
tidy
Starts a tidy run and waits until it is done (defaults).- Returns:
- the last status
-
tidy
Starts a tidy run (POST <mount>/tidy, 202) and, unlessawait(false), pollstidy-statusuntil it isFinished,ErrororCancelled.- Parameters:
options- options- Returns:
- the last status
-
tidyAsync
Asynchronoustidy(TidyOptions).- Parameters:
o- options- Returns:
- a future with the last status
-
toString
-