Class AcmeAccount
- java.lang.Object
-
- org.wildfly.security.x500.cert.acme.AcmeAccount
-
public final class AcmeAccount extends Object
A class that represents an Automatic Certificate Management Environment (ACME) account.- Since:
- 1.5.0
- Author:
- Farah Juma
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAcmeAccount.Builder
-
Field Summary
Fields Modifier and Type Field Description private StringaccountUrlprivate StringalgHeaderprivate X509Certificatecertificateprivate String[]contactUrlsprivate X500Principaldnprivate StringkeyAlgorithmNameprivate intkeySizeprivate byte[]nonceprivate PrivateKeyprivateKeyprivate HashMap<AcmeResource,URL>resourceUrlsprivate StringserverUrlprivate StringsignatureAlgorithmprivate HashMap<AcmeResource,URL>stagingResourceUrlsprivate StringstagingServerUrlprivate booleantermsOfServiceAgreed
-
Constructor Summary
Constructors Modifier Constructor Description privateAcmeAccount(AcmeAccount.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AcmeAccount.Builderbuilder()Construct a new builder instance.voidchangeCertificateAndPrivateKey(X509Certificate certificate, PrivateKey privateKey)Change the certificate and private key associated with this account.StringgetAccountUrl()Return the account location URL ornullif this account has not yet been successfully registered with the ACME server.StringgetAlgHeader()Get the JWS "alg" header parameter value for this account.X509CertificategetCertificate()Get the X.509 certificate that contains the account public key.String[]getContactUrls()Get the account contact URLs.X500PrincipalgetDn()Get the DN from the X.509 certificate that contains the account public key.StringgetKeyAlgorithmName()Get the key algorithm name.intgetKeySize()Get the key size.byte[]getNonce()Get the current nonce for this account.PrivateKeygetPrivateKey()Get the account private key.PublicKeygetPublicKey()Get the account public key.URLgetResourceUrl(AcmeResource resource, boolean staging)Get the URL for the given ACME resource.Map<AcmeResource,URL>getResourceUrls(boolean staging)Get the ACME resource URLs.StringgetServerUrl()Get the ACME server URL.StringgetServerUrl(boolean staging)Get the ACME server URL.SignaturegetSignature()Get a signature instance for this account.StringgetStagingServerUrl()Get the ACME staging server URL.booleanisTermsOfServiceAgreed()Return whether or not the ACME server's terms of service have been agreed to.voidsetAccountUrl(String accountUrl)Set the account location URL provided by the ACME server.voidsetContactUrls(String[] contactUrls)Set the account contact URLs.voidsetNonce(byte[] nonce)Set the new nonce for this account.voidsetTermsOfServiceAgreed(boolean termsOfServiceAgreed)Set whether the terms of services have been agreed to.
-
-
-
Field Detail
-
contactUrls
private String[] contactUrls
-
termsOfServiceAgreed
private boolean termsOfServiceAgreed
-
serverUrl
private String serverUrl
-
stagingServerUrl
private String stagingServerUrl
-
privateKey
private PrivateKey privateKey
-
certificate
private X509Certificate certificate
-
dn
private X500Principal dn
-
algHeader
private String algHeader
-
signatureAlgorithm
private String signatureAlgorithm
-
keySize
private int keySize
-
keyAlgorithmName
private String keyAlgorithmName
-
accountUrl
private String accountUrl
-
resourceUrls
private HashMap<AcmeResource,URL> resourceUrls
-
stagingResourceUrls
private HashMap<AcmeResource,URL> stagingResourceUrls
-
nonce
private byte[] nonce
-
-
Constructor Detail
-
AcmeAccount
private AcmeAccount(AcmeAccount.Builder builder)
-
-
Method Detail
-
getContactUrls
public String[] getContactUrls()
Get the account contact URLs.- Returns:
- the contact URLs
-
setContactUrls
public void setContactUrls(String[] contactUrls)
Set the account contact URLs.- Parameters:
contactUrls- the contact URLs (must not benull)
-
isTermsOfServiceAgreed
public boolean isTermsOfServiceAgreed()
Return whether or not the ACME server's terms of service have been agreed to.- Returns:
- whether or not the ACME server's terms of service have been agreed to
-
setTermsOfServiceAgreed
public void setTermsOfServiceAgreed(boolean termsOfServiceAgreed)
Set whether the terms of services have been agreed to.- Parameters:
termsOfServiceAgreed- whether or not the ACME server's terms of service have been agreed to
-
getServerUrl
public String getServerUrl()
Get the ACME server URL.- Returns:
- the ACME server URL
-
getServerUrl
public String getServerUrl(boolean staging)
Get the ACME server URL.- Parameters:
staging- whether or not the ACME staging server should be returned- Returns:
- the ACME server URL
-
getStagingServerUrl
public String getStagingServerUrl()
Get the ACME staging server URL.- Returns:
- the ACME staging server URL
-
getPrivateKey
public PrivateKey getPrivateKey()
Get the account private key.- Returns:
- the account private key
-
getPublicKey
public PublicKey getPublicKey()
Get the account public key.- Returns:
- the account public key
-
getCertificate
public X509Certificate getCertificate()
Get the X.509 certificate that contains the account public key.- Returns:
- the X.509 certificate that contains the account public key
-
getDn
public X500Principal getDn()
Get the DN from the X.509 certificate that contains the account public key.
-
getAlgHeader
public String getAlgHeader()
Get the JWS "alg" header parameter value for this account.- Returns:
- the JWS "alg" header parameter value for this account
-
getSignature
public Signature getSignature()
Get a signature instance for this account.- Returns:
- a signature instance for this account
-
getKeySize
public int getKeySize()
Get the key size.- Returns:
- the key size
-
getKeyAlgorithmName
public String getKeyAlgorithmName()
Get the key algorithm name.- Returns:
- the key algorithm name
-
getAccountUrl
public String getAccountUrl()
Return the account location URL ornullif this account has not yet been successfully registered with the ACME server.- Returns:
- the account location URL or
nullif this account has not yet been successfully registered with the ACME server
-
setAccountUrl
public void setAccountUrl(String accountUrl)
Set the account location URL provided by the ACME server.- Parameters:
accountUrl- the account location URL (must not benull)
-
getResourceUrl
public URL getResourceUrl(AcmeResource resource, boolean staging)
Get the URL for the given ACME resource.- Parameters:
resource- the ACME resource (must not benull)staging- whether or not the ACME staging server should be used- Returns:
- the URL for the given ACME resource
-
getResourceUrls
public Map<AcmeResource,URL> getResourceUrls(boolean staging)
Get the ACME resource URLs.- Parameters:
staging- whether or not the ACME staging server should be used- Returns:
- the ACME resource URLs
-
getNonce
public byte[] getNonce()
Get the current nonce for this account.- Returns:
- the current nonce for this account
-
setNonce
public void setNonce(byte[] nonce)
Set the new nonce for this account.- Parameters:
nonce- the new nonce for this account (must not benull)
-
changeCertificateAndPrivateKey
public void changeCertificateAndPrivateKey(X509Certificate certificate, PrivateKey privateKey)
Change the certificate and private key associated with this account.- Parameters:
certificate- the new certificate (must not benull)privateKey- the new private key (must not benull)
-
builder
public static AcmeAccount.Builder builder()
Construct a new builder instance.- Returns:
- the new builder instance
-
-