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 class
AcmeAccount.Builder
-
Field Summary
Fields Modifier and Type Field Description private String
accountUrl
private String
algHeader
private X509Certificate
certificate
private String[]
contactUrls
private X500Principal
dn
private String
keyAlgorithmName
private int
keySize
private byte[]
nonce
private PrivateKey
privateKey
private HashMap<AcmeResource,URL>
resourceUrls
private String
serverUrl
private String
signatureAlgorithm
private HashMap<AcmeResource,URL>
stagingResourceUrls
private String
stagingServerUrl
private boolean
termsOfServiceAgreed
-
Constructor Summary
Constructors Modifier Constructor Description private
AcmeAccount(AcmeAccount.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AcmeAccount.Builder
builder()
Construct a new builder instance.void
changeCertificateAndPrivateKey(X509Certificate certificate, PrivateKey privateKey)
Change the certificate and private key associated with this account.String
getAccountUrl()
Return the account location URL ornull
if this account has not yet been successfully registered with the ACME server.String
getAlgHeader()
Get the JWS "alg" header parameter value for this account.X509Certificate
getCertificate()
Get the X.509 certificate that contains the account public key.String[]
getContactUrls()
Get the account contact URLs.X500Principal
getDn()
Get the DN from the X.509 certificate that contains the account public key.String
getKeyAlgorithmName()
Get the key algorithm name.int
getKeySize()
Get the key size.byte[]
getNonce()
Get the current nonce for this account.PrivateKey
getPrivateKey()
Get the account private key.PublicKey
getPublicKey()
Get the account public key.URL
getResourceUrl(AcmeResource resource, boolean staging)
Get the URL for the given ACME resource.Map<AcmeResource,URL>
getResourceUrls(boolean staging)
Get the ACME resource URLs.String
getServerUrl()
Get the ACME server URL.String
getServerUrl(boolean staging)
Get the ACME server URL.Signature
getSignature()
Get a signature instance for this account.String
getStagingServerUrl()
Get the ACME staging server URL.boolean
isTermsOfServiceAgreed()
Return whether or not the ACME server's terms of service have been agreed to.void
setAccountUrl(String accountUrl)
Set the account location URL provided by the ACME server.void
setContactUrls(String[] contactUrls)
Set the account contact URLs.void
setNonce(byte[] nonce)
Set the new nonce for this account.void
setTermsOfServiceAgreed(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 ornull
if this account has not yet been successfully registered with the ACME server.- Returns:
- the account location URL or
null
if 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
-
-