/** * Revoke the given certificate. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param certificate the certificate to be revoked (must not be {@code null}) * @throws AcmeException if an error occurs while attempting to revoke the given certificate */ public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) throws AcmeException { revokeCertificate(account, staging, certificate, null); }
/** * Revoke the given certificate. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param certificate the certificate to be revoked (must not be {@code null}) * @throws AcmeException if an error occurs while attempting to revoke the given certificate */ public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) throws AcmeException { revokeCertificate(account, staging, certificate, null); }
/** * Revoke the given certificate. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param certificate the certificate to be revoked (must not be {@code null}) * @throws AcmeException if an error occurs while attempting to revoke the given certificate */ public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) throws AcmeException { revokeCertificate(account, staging, certificate, null); }
/** * Revoke the given certificate. * * @param account the ACME account information to use (must not be {@code null}) * @param staging whether or not the staging server URL should be used * @param certificate the certificate to be revoked (must not be {@code null}) * @throws AcmeException if an error occurs while attempting to revoke the given certificate */ public void revokeCertificate(AcmeAccount account, boolean staging, X509Certificate certificate) throws AcmeException { revokeCertificate(account, staging, certificate, null); }
@Override protected void executeRuntimeStep(final OperationContext context, final ModelNode operation) throws OperationFailedException { ModifiableKeyStoreService keyStoreService = getModifiableKeyStoreService(context); KeyStore keyStore = keyStoreService.getModifiableValue(); String alias = ALIAS.resolveModelAttribute(context, operation).asString(); String reason = REASON.resolveModelAttribute(context, operation).asStringOrNull(); String certificateAuthorityAccountName = CERTIFICATE_AUTHORITY_ACCOUNT.resolveModelAttribute(context, operation).asString(); boolean staging = STAGING.resolveModelAttribute(context, operation).asBoolean(); try { if (! keyStore.containsAlias(alias)) { throw ROOT_LOGGER.keyStoreAliasDoesNotExist(alias); } X509Certificate certificateToRevoke = (X509Certificate) keyStore.getCertificate(alias); if (certificateToRevoke == null) { throw ROOT_LOGGER.unableToObtainCertificate(alias); } final AcmeAccount acmeAccount = getAcmeAccount(context, certificateAuthorityAccountName, staging); if (reason != null) { acmeClient.revokeCertificate(acmeAccount, staging, certificateToRevoke, getCRLReason(reason)); } else { acmeClient.revokeCertificate(acmeAccount, staging, certificateToRevoke); } keyStore.deleteEntry(alias); ((KeyStoreService) keyStoreService).save(); } catch (IllegalArgumentException | AcmeException e) { throw new OperationFailedException(e); } catch (KeyStoreException e) { throw new RuntimeException(e); } }