Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed Standardized TXT format for certis #14

Open
trbouma opened this issue Feb 12, 2024 · 0 comments
Open

Proposed Standardized TXT format for certis #14

trbouma opened this issue Feb 12, 2024 · 0 comments

Comments

@trbouma
Copy link
Collaborator

trbouma commented Feb 12, 2024

Proposed standardized way to add public key information in a DNS TXT record
Use the URI scheme, so it can be easily parsed.

TXT record in the format of "cert:secp256k1/ecdsa?kid=02300d753f822691b63c0c79134aa2069c946768600a3fb32b6078b8209e75d203"

scheme is "cert"
path is curve/algoriithm eg.: "secp256k1/ecdsa", "secp256k1/ecdsarecovery", "secp256k1/schnorr", etc,
query contains parameters, e.g. "kid" is hex encoded string of public key.

This allows any curve/algorithm to be easily specified, and the urllib library makes it easy to parse out any additional parameters, if required.

Also use _cert_ as standardized qualifier.

code snippet on how to parse.

# Example of how to parse a TXT Record
from urllib.parse import parse_qs
from urllib.parse import urlparse

# get record from DNS TXT record e;g., _cert.example.com
certificate_record = "cert:secp256k1/ecdsa?kid=02300d753f822691b63c0c79134aa2069c946768600a3fb32b6078b8209e75d203"

parsed_record = urlparse(certificate_record)
parsed_dict = parse_qs(parsed_record.query)

# Note that parse_qs returns each parameter as a list, so need to take element [0]

print(parsed_record.path)
print(parsed_dict)
pubkey = parsed_dict['kid'][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant