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

Automatic Cleaning and Scheduling of PostgreSQL Rotate Tables — Constraints and Triggers

Creating and Using Resource Files in Android Studio

The first thing that must be defined is the shell.What is a shell and what it is used for.

Pointers in C

Re-thinking the structure of event data

How to Build a User-centric Community Idea Box for Your Product

How to Install Apache Solr on Ubuntu 16.04

How to store translations inside a database with Globalize

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

High Level Architecture for IoT Platform in 2022

How to Pass GCP Professional Cloud Developer

Produce and consume messages from a Kafka topic using docker

How to use multiple GCP providers in Terraform