Let’s Encrypt ACME with Alibaba Cloud API Gateway and CDN — Part 4

Example ACME Request

POST /acme/new-account HTTP/1.1
Host: acme-staging-v02.api.letsencrypt.org
Content-Type: application/jose+json
{
"protected": base64_encode({
"alg": "ES256",
"jwk": {...},
"nonce": "6S8IqOGY7eL2lsGoTZYifg",
"url": "https://acme-staging-v02.api.letsencrypt.org/acme/new-acct"
}),
"payload": base64_encode({
"termsOfServiceAgreed": true,
"contact": [
"mailto:cert-admin@example.com",
"mailto:admin@example.com"
]
}),
"signature": "RZPOnYoPs1PhjszF...-nh6X1qtOFPB519I"
}

ACME API HTTP Request Body

{
"protected": base64_encode(jws_protected_header),
"payload": base64_encode(payload),
"signature": based64_encode(signature)
}

JWS Protected Header

JWS Web Key (JWK)

{
"e": base64_encode(public_exponent),
"kty": "RSA",
"n": base64_encode(modulus),
}

Payload

"payload": base64_encode({
"termsOfServiceAgreed": true,
"contact": [
"mailto:cert-admin@example.com",
"mailto:admin@example.com"
]
})

Signature

def sign(data, keyfile):
""" Create the ACME API Signature """
# Load the RSA Private Key from the file (RSA PKCS #1)
pkey = load_private_key(keyfile)
# Create the signature
sig = crypto.sign(pkey, data, "sha256")
return sig

Summary

--

--

--

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Install and Configure VNC on an Alibaba Cloud ECS Instance

Q&A — High CPU Usage on Alibaba Cloud SQL Server

Getting Started With Spreedly — The Most Common Questions

Flutter Continuous Integration using GitLab

GIPHY Product Spotlight: How GIPHY Brought Closed Captions to Clips

Which programming language should I learn to be a Software Engineer?

The Future of Software Testing — Top 4 Cloud Testing Trends in 2022

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com

More from Medium

Parsing CVS file from Google Storage using Cloud Function, DataProc and java application using…

Starting stopped docker container

Practical docker

How to update Appsettings.json based on deployment environment using yaml.