use std::{io, time::Duration}; use clap::Parser; use rustls::Certificate; use tokio::time::sleep; use tracing::{error, info}; use instant_acme::{ Account, AuthorizationStatus, ChallengeType, Identifier, LetsEncrypt, NewAccount, NewOrder, OrderStatus, }; #[tokio::main] async fn main() -> anyhow::Result<()> { tracing_subscriber::fmt::init(); // let opts = Options::parse(); // Create a new account. This will generate a fresh ECDSA key for you. // Alternatively, restore an account from serialized credentials by // using `Account::from_credentials()`. // let account = Account::create( // &NewAccount { // contact: &[], // terms_of_service_agreed: true, // only_return_existing: false, // }, // LetsEncrypt::Staging.url(), // ) // .await?; let creds = serde_json::from_str(ACCOUNT).unwrap(); let account = Account::from_credentials(creds).unwrap(); let certs = rustls_pemfile::certs(&mut CERT).unwrap(); let cert = certs[0].clone(); account.revoke(&Certificate(cert)).await.unwrap(); // info!( // "account credentials:\n\n{}", // serde_json::to_string_pretty(&ACCOUNT.credentials()).unwrap() // ); Ok(()) } /// SMTP server #[derive(Parser)] struct Options { // #[clap(long)] // name: String, } const CERT: &[u8] = b"-----BEGIN CERTIFICATE----- MIID8TCCA3igAwIBAgITAPrsbmSSkWU08+AFKwWnHLCgCjAKBggqhkjOPQQDAzBV MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXKFNUQUdJTkcpIExldCdzIEVuY3J5cHQx JDAiBgNVBAMTGyhTVEFHSU5HKSBFcnNhdHogRWRhbWFtZSBFMTAeFw0yMjExMzAx NzM2NTlaFw0yMzAyMjgxNzM2NThaMCExHzAdBgNVBAMTFnNhZ2U4OS5tZXNzd2l0 aGRucy5jb20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS9Vx9GxJCvGffEZqgW mEtBx6s8kUTGQp+K7afTae1sz/GrOnRnNYwGkQaRRaRkNiU6SoPSpaIEF7SppfLE VQ+Ro4ICWTCCAlUwDgYDVR0PAQH/BAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMB BggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0GA1UdDgQWBBT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lK8VD92SYbp olFsJZWuHVkHgccuI1Hx0+RUp1VGj1PPV+0JmGZeG2ybLloU2rjjMbRmkNjTxub2 U1vzCGpBSaBfYQLjLHDwQk1AqRENlZxDqCkXFro8eqT6TFHdtw27KIT+ov1Qyofi q3Uj1w7tPpcFMSDfiWNRE0XGYCjELDo19oPqQthIMQ5X+/3YpCqZceR4vMR6n9ol Lp/0KmjAzqU+LqD2fmFLttKvZUxW8aECTGIcDHGCPJDklwDW3l7DUQ08Wj5Fh/KE f5c9fF3u87WUAJu4Vh9C+ewXZtzL0LD46lYgpn7fv5w9sLS4zQ3CIC3udjJ5Gc/v 8VhPQaU1Enn7NW+4IHnfSeP6G5rzLEtl0PreC4k= -----END CERTIFICATE-----"; const ACCOUNT: &str = " { \"id\": \"https://acme-staging-v02.api.letsencrypt.org/acme/acct/78060154\", \"key_pkcs8\": \"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgvjyueuqwXkRd0jjqRsYO6cIwvIctiPt1gqlLgMppwiehRANCAATUfP9I90-kJqSfW0ocUSG8Rmt6Du4U6goTdfx7as2ThDAsCYnFJlqOqe2RKJfeHfjMD_0Ks0N_PAFey8agM41h\", \"urls\": { \"newNonce\": \"https://acme-staging-v02.api.letsencrypt.org/acme/new-nonce\", \"newAccount\": \"https://acme-staging-v02.api.letsencrypt.org/acme/new-acct\", \"newOrder\": \"https://acme-staging-v02.api.letsencrypt.org/acme/new-order\", \"revokeCert\": \"https://acme-staging-v02.api.letsencrypt.org/acme/revoke-cert\" } } ";