@Test public void testGetNonce() throws Exception { final String NEW_NONCE_RESPONSE = "zincG439TOpiDIeJBbmInMOo_xnZV0jpUstA4VZgSiyuFy0"; server = setupTestGetNonce(); AcmeAccount account = populateBasicAccount(ACCOUNT_1_V2); account.setNonce(CodePointIterator.ofString("rtJAy_mcjDFGnnzCOAbGMGM6w8P3qU0bRDMf8sjt5IU").base64Decode(BASE64_URL, false).drain()); String nonce = ByteIterator.ofBytes(account.getNonce()).base64Encode(BASE64_URL, false).drainToString(); assertNotNull(nonce); String newNonce = ByteIterator.ofBytes(acmeClient.getNewNonce(account, false)).base64Encode(BASE64_URL, false).drainToString(); assertFalse(nonce.equals(newNonce)); assertEquals(NEW_NONCE_RESPONSE, newNonce); }
private byte[] getNonce(AcmeAccount account, boolean staging) throws AcmeException { byte[] nonce = account.getNonce(); if (nonce == null) { nonce = getNewNonce(account, staging); } return nonce; }
AcmeClientSpi { private byte[] getNonce(AcmeAccount account, boolean staging) throws AcmeException { byte[] nonce = account.getNonce(); if (nonce == null) { nonce = getNewNonce(account, staging); } return nonce; } }
AcmeClientSpi { private byte[] getNonce(AcmeAccount account, boolean staging) throws AcmeException { byte[] nonce = account.getNonce(); if (nonce == null) { nonce = getNewNonce(account, staging); } return nonce; }  }
AcmeClientSpi { private byte[] getNonce(AcmeAccount account, boolean staging) throws AcmeException { byte[] nonce = account.getNonce(); if (nonce == null) { nonce = getNewNonce(account, staging); } return nonce; }  Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging); AcmeMetadata getMetadata(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging, boolean onlyReturnExisting); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed); void updateAccount(AcmeAccount account, boolean staging, String[] contactUrls); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls); void changeAccountKey(AcmeAccount account, boolean staging); void changeAccountKey(AcmeAccount account, boolean staging, X509Certificate certificate, PrivateKey privateKey); void deactivateAccount(AcmeAccount account, boolean staging); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String keyAlgorithmName, int keySize,
                                                                    String... domainNames); String createAuthorization(AcmeAccount account, boolean staging, String domainName); void deactivateAuthorization(AcmeAccount account, boolean staging, String authorizationUrl); abstract AcmeChallenge proveIdentifierControl(AcmeAccount account, List<AcmeChallenge> challenges); abstract void cleanupAfterChallenge(AcmeAccount account, AcmeChallenge challenge); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate, CRLReason reason); byte[] getNewNonce(final AcmeAccount account, final boolean staging); }
AcmeClientSpi { private byte[] getNonce(AcmeAccount account, boolean staging) throws AcmeException { byte[] nonce = account.getNonce(); if (nonce == null) { nonce = getNewNonce(account, staging); } return nonce; }  Map<AcmeResource, URL> getResourceUrls(AcmeAccount account, boolean staging); AcmeMetadata getMetadata(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging); boolean createAccount(AcmeAccount account, boolean staging, boolean onlyReturnExisting); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed); void updateAccount(AcmeAccount account, boolean staging, String[] contactUrls); void updateAccount(AcmeAccount account, boolean staging, boolean termsOfServiceAgreed, String[] contactUrls); void changeAccountKey(AcmeAccount account, boolean staging); void changeAccountKey(AcmeAccount account, boolean staging, X509Certificate certificate, PrivateKey privateKey); void deactivateAccount(AcmeAccount account, boolean staging); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String... domainNames); X509CertificateChainAndSigningKey obtainCertificateChain(AcmeAccount account, boolean staging, String keyAlgorithmName, int keySize,
                                                                    String... domainNames); String createAuthorization(AcmeAccount account, boolean staging, String domainName); void deactivateAuthorization(AcmeAccount account, boolean staging, String authorizationUrl); abstract AcmeChallenge proveIdentifierControl(AcmeAccount account, List<AcmeChallenge> challenges); abstract void cleanupAfterChallenge(AcmeAccount account, AcmeChallenge challenge); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate); void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate, CRLReason reason); byte[] getNewNonce(final AcmeAccount account, final boolean staging); static final int DEFAULT_EC_KEY_SIZE; static final int DEFAULT_KEY_SIZE; static final String DEFAULT_KEY_ALGORITHM_NAME; }