All Projects → lmb → asinine

lmb / asinine

Licence: other
Embeddable ASN.1 (DER) and X.509v3 decoder

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to asinine

Phpseclib
PHP Secure Communications Library
Stars: ✭ 4,627 (+13508.82%)
Mutual labels:  x509, asn1
rasn
A Safe #[no_std] ASN.1 Codec Framework
Stars: ✭ 131 (+285.29%)
Mutual labels:  asn1, der
asn1-ts
ASN.1 TypeScript library, including codecs for Basic Encoding Rules (BER) and Distinguished Encoding Rules (DER).
Stars: ✭ 26 (-23.53%)
Mutual labels:  asn1, der
rasn1
Ruby ASN.1 library
Stars: ✭ 14 (-58.82%)
Mutual labels:  asn1, der
pem-utils
Managed .NET (C#) utility library for working with PEM files with DER/ASN.1 encoding
Stars: ✭ 62 (+82.35%)
Mutual labels:  asn1, der
der-parser
BER/DER parser written in pure Rust. Fast, zero-copy, safe.
Stars: ✭ 73 (+114.71%)
Mutual labels:  asn1, der
Jsrsasign
The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES JSON Web Signature/Token in pure JavaScript.
Stars: ✭ 2,760 (+8017.65%)
Mutual labels:  x509, asn1
Forge
A native implementation of TLS in Javascript and tools to write crypto-based and network-heavy webapps
Stars: ✭ 4,204 (+12264.71%)
Mutual labels:  x509, asn1
Asn1DerParser.NET
Abstract Syntax Notation One (ASN.1) binary parser to support Distinguished Encoding Rules (DER) in .NET
Stars: ✭ 31 (-8.82%)
Mutual labels:  asn1, der
certbot-dns-powerdns
PowerDNS DNS Authenticator plugin for Certbot
Stars: ✭ 22 (-35.29%)
Mutual labels:  x509
pki-manager
IT Freelancers : Manage small PKI for multiple projects (or clients) with 2 bash scripts
Stars: ✭ 36 (+5.88%)
Mutual labels:  x509
Asn1crypto
Python ASN.1 library with a focus on performance and a pythonic API
Stars: ✭ 220 (+547.06%)
Mutual labels:  x509
Zlint
X.509 Certificate Linter focused on Web PKI standards and requirements.
Stars: ✭ 190 (+458.82%)
Mutual labels:  x509
certbot-dns-acmedns
Certbot ACME-DNS DNS01 plugin for Certbot
Stars: ✭ 24 (-29.41%)
Mutual labels:  x509
certgrinder
Certgrinder is a client/server system for getting LetsEncrypt certificates for your infrastructure. ACME challenges are handled by the Certgrinder server, making it possible to get certificates in highly isolated environments, since only an SSH connection to the Certgrinder server is needed.
Stars: ✭ 24 (-29.41%)
Mutual labels:  x509
sscg
Simple Signed Certificate Generator
Stars: ✭ 57 (+67.65%)
Mutual labels:  x509
clone-cert
Simple shell script to "clone" X.509 certificates
Stars: ✭ 65 (+91.18%)
Mutual labels:  x509
Go Guardian
Go-Guardian is a golang library that provides a simple, clean, and idiomatic way to create powerful modern API and web authentication.
Stars: ✭ 204 (+500%)
Mutual labels:  x509
spyder
Simple Python package for fast DER computation
Stars: ✭ 17 (-50%)
Mutual labels:  der
kms-issuer
KMS issuer is a cert-manager Certificate Request controller that uses AWS KMS to sign the certificate request.
Stars: ✭ 43 (+26.47%)
Mutual labels:  x509

libasinine

libasinine provides decoding facilities of DER encoded ASN.1 data, as well as X.509v3 (and earlier) certificates. The focus is on small size and static memory allocation, making it suitable for use in an embedded environment. In general, you are encouraged to ship libasinine with your code, and link to it statically.

Status

The library is still alpha quality, but correctly parses and validates 98% of the certificates used by the Alexa Top 10k sites.

Be warned: libasinine will shoot you in the foot and then run away with the savings you hid under your mattress.

ASN.1

The implementation follows ITU-T X.680 (11/2008) and ITU-T X.690 (11/2008), and has the functionality required to parse X.509 certificates. The only supported character set is UTF-8 (and by extension ASCII).

X.509

The implementation largely follows RFC 5280. Only a limited set of extensions is supported:

  • Basic Constraints
  • Key Usage
  • Extended Key Usage
  • Subject Alternative Name (only common ones)

This is enough to parse most certificates used for HTTP traffic. There is a small utility which excercises this part of the library.

> brew install mbedtls # on macOS
> make x509
> ./bin/Debug/x509 -h
x509 <options> (<certs file>|-)
  --check[=trust store|-]    Validate certificates against trust store

  Use '-' to read from stdin. Only a single argument can be read from stdin.

Requirements

  • GCC / Clang (C99)
  • libc
  • Optional: mbedtls (for utilities)

Compiling

> make tests
> ./bin/Debug/tests

Usage

The current API is subject to change. Have a look at x509.c for a more complex / convoluted example.

#include <stdint.h>
#include <asinine/dsl.h>

/* ... */

asinine_err_t
parse_asn1(const uint8_t *data, size_t length) {
	asn1_parser_t parser;
	asn1_init(&parser, data, length);

	NEXT_TOKEN(&parser);

	// "token" now contains the next token
	if (!asn1_is_seq(parser.token)) {
		return ERROR(ASININE_ERR_INVALID, "expected sequence");
	}

	// Iterate over unknown number of children
	RETURN_ON_ERROR(asn1_push_seq(&parser));

	while (!asn1_eof(&parser)) {
		// Call NEXT_TOKEN and process it
	}

	// Undo the push from before
	RETURN_ON_ERROR(asn1_pop(&parser));

	// Do some more parsing

	// Make sure there the buffer has been fully parsed
	if (!asn1_end(&parser)) {
		return ERROR(ASININE_ERR_MALFORMED, "trailing data");
	}

	// Yay!
	return ERROR(ASININE_OK, NULL);
}

License

libasinine is licensed unter the Mozilla Public License 2.0, please see LICENSE for details.

The implications are: you can link statically to libasinine, without having to release your own code. Modifications to libasinine have to be made public though.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].