deno_std
deno_std copied to clipboard
node/crypto: add `X509Certificate` class from node.js crypto
Node.js docs reference
https://nodejs.org/api/crypto.html#crypto_class_x509certificate
Implementation interface
import { Buffer } from "../buffer.ts";
import { ERR_INVALID_ARG_TYPE } from "../_errors.ts";
import { isArrayBufferView } from "../_util/_util_types.ts";
export class X509Certificate {
constructor(buffer: string | Buffer | DataView) {
if (typeof buffer === "string") buffer = Buffer.from(buffer);
if (!isArrayBufferView(buffer)) {
throw new ERR_INVALID_ARG_TYPE("buffer", [
"string",
"Buffer",
"TypedArray",
"DataView",
], buffer);
}
}
get subject(): string {}
get subjectAltName() {}
get issuer(): string {}
get issuerCertificate() {}
get infoAccess() {}
get validFrom(): string {}
get validTo(): string {}
get fingerprint(): string {}
get fingerprint256(): string {}
get keyUsage() {}
get serialNumber(): string {}
get raw() {}
get publicKey() {}
toString(): string {}
// There's no standardized JSON encoding for X509 certs so we
// fallback to providing the PEM encoding as a string.
toJSON() {
return this.toString();
}
get ca(): boolean {}
checkHost(name, options) {}
checkEmail(email, options) {}
checkIP(ip, options) {}
checkIssued(otherCert) {}
checkPrivateKey(pkey) {}
verify(pkey) {}
}
Hi.
This issue seems closely related to a similar request made in https://github.com/denoland/deno_std/issues/981. So we may want to merge them in a unique thread.
Also, as Deno std lib is closely modeled from Go std lib inspiration, https://pkg.go.dev/encoding/pem may also be worth implementing as dealing with PEM is often related to handling X509 certificates.