const UNKNOWN_SIGNATURE_ALGORITHM
pub const UNKNOWN_SIGNATURE_ALGORITHM = 0Purpose
Constant UNKNOWN_SIGNATURE_ALGORITHM, defining protocol or algorithm parameters.
#crypto/x509Parse certificates and verify (Ed25519, RSA SHA-256, SM2-with-SM3). No issuance.
const UNKNOWN_SIGNATURE_ALGORITHMpub const UNKNOWN_SIGNATURE_ALGORITHM = 0Constant UNKNOWN_SIGNATURE_ALGORITHM, defining protocol or algorithm parameters.
const MD5_WITH_RSApub const MD5_WITH_RSA = 2Constant MD5_WITH_RSA, defining protocol or algorithm parameters.
const SHA1_WITH_RSApub const SHA1_WITH_RSA = 3Constant SHA1_WITH_RSA, defining protocol or algorithm parameters.
const SHA256_WITH_RSApub const SHA256_WITH_RSA = 4Constant SHA256_WITH_RSA, defining protocol or algorithm parameters.
const SHA384_WITH_RSApub const SHA384_WITH_RSA = 5Constant SHA384_WITH_RSA, defining protocol or algorithm parameters.
const SHA512_WITH_RSApub const SHA512_WITH_RSA = 6Constant SHA512_WITH_RSA, defining protocol or algorithm parameters.
const ECDSA_WITH_SHA256pub const ECDSA_WITH_SHA256 = 10Constant ECDSA_WITH_SHA256, defining protocol or algorithm parameters.
const ECDSA_WITH_SHA384pub const ECDSA_WITH_SHA384 = 11Constant ECDSA_WITH_SHA384, defining protocol or algorithm parameters.
const ECDSA_WITH_SHA512pub const ECDSA_WITH_SHA512 = 12Constant ECDSA_WITH_SHA512, defining protocol or algorithm parameters.
const PURE_ED25519pub const PURE_ED25519 = 16Constant PURE_ED25519, defining protocol or algorithm parameters.
const SM2_WITH_SM3pub const SM2_WITH_SM3 = 20Constant SM2_WITH_SM3, defining protocol or algorithm parameters.
const UNKNOWN_PUBLIC_KEY_ALGORITHMpub const UNKNOWN_PUBLIC_KEY_ALGORITHM = 0Constant UNKNOWN_PUBLIC_KEY_ALGORITHM, defining protocol or algorithm parameters.
const RSApub const RSA = 1Constant RSA, defining protocol or algorithm parameters.
const DSApub const DSA = 2Constant DSA, defining protocol or algorithm parameters.
const ECDSApub const ECDSA = 3Constant ECDSA, defining protocol or algorithm parameters.
const ED25519pub const ED25519 = 4Constant ED25519, defining protocol or algorithm parameters.
const SM2pub const SM2 = 5Constant SM2, defining protocol or algorithm parameters.
const KEY_USAGE_DIGITAL_SIGNATUREpub const KEY_USAGE_DIGITAL_SIGNATURE = 1RFC 5280 KeyUsage bit positions, aligned with crypto/x509.
const KEY_USAGE_CONTENT_COMMITMENTpub const KEY_USAGE_CONTENT_COMMITMENT = 2Constant KEY_USAGE_CONTENT_COMMITMENT, defining protocol or algorithm parameters.
const KEY_USAGE_KEY_ENCIPHERMENTpub const KEY_USAGE_KEY_ENCIPHERMENT = 4Constant KEY_USAGE_KEY_ENCIPHERMENT, defining protocol or algorithm parameters.
const KEY_USAGE_DATA_ENCIPHERMENTpub const KEY_USAGE_DATA_ENCIPHERMENT = 8Constant KEY_USAGE_DATA_ENCIPHERMENT, defining protocol or algorithm parameters.
const KEY_USAGE_KEY_AGREEMENTpub const KEY_USAGE_KEY_AGREEMENT = 16Constant KEY_USAGE_KEY_AGREEMENT, defining protocol or algorithm parameters.
const KEY_USAGE_CERT_SIGNpub const KEY_USAGE_CERT_SIGN = 32Constant KEY_USAGE_CERT_SIGN, defining protocol or algorithm parameters.
const KEY_USAGE_CRL_SIGNpub const KEY_USAGE_CRL_SIGN = 64Constant KEY_USAGE_CRL_SIGN, defining protocol or algorithm parameters.
const KEY_USAGE_ENCIPHER_ONLYpub const KEY_USAGE_ENCIPHER_ONLY = 128Constant KEY_USAGE_ENCIPHER_ONLY, defining protocol or algorithm parameters.
const KEY_USAGE_DECIPHER_ONLYpub const KEY_USAGE_DECIPHER_ONLY = 256Constant KEY_USAGE_DECIPHER_ONLY, defining protocol or algorithm parameters.
struct Certificatepub struct Certificate {
pub raw string
pub raw_tbs_certificate string
pub raw_subject_public_key_info string
pub raw_subject string
pub raw_issuer string
pub signature string
pub signature_algorithm int
pub public_key_algorithm int
pub public_key string
pub version int
pub serial_number big.Int
pub serial_bytes string
pub issuer pkix.Name
pub subject pkix.Name
pub not_before time.Time
pub not_after time.Time
pub is_ca bool
pub basic_constraints_valid bool
pub max_path_len int
pub max_path_len_zero bool
pub key_usage int
pub key_usage_present bool
pub subject_key_id string
pub authority_key_id string
pub ext_key_usage []int
pub ext_key_usage_present bool
pub has_unknown_ext_key_usage bool
pub permitted_dns_domains []string
pub excluded_dns_domains []string
pub permitted_ip_ranges []string
pub excluded_ip_ranges []string
pub name_constraints_present bool
pub name_constraints_unsupported bool
pub certificate_policies []string
pub certificate_policies_present bool
pub policy_mapping_issuers []string
pub policy_mapping_subjects []string
pub policy_mappings_present bool
pub require_explicit_policy int
pub inhibit_policy_mapping int
pub policy_constraints_present bool
pub inhibit_any_policy int
pub inhibit_any_policy_present bool
pub has_unhandled_critical_extension bool
pub dns_names []string
pub ip_addresses []string
}Structure encapsulating raw, raw_tbs_certificate, raw_subject_public_key_info, raw_subject, raw_issuer.
raw stringraw_tbs_certificate stringraw_subject_public_key_info stringraw_subject stringraw_issuer stringsignature stringsignature_algorithm intpublic_key_algorithm intpublic_key stringversion intserial_number big.Intserial_bytes stringissuer pkix.Namesubject pkix.Namenot_before time.Timenot_after time.Timeis_ca boolbasic_constraints_valid boolmax_path_len intmax_path_len_zero boolkey_usage intkey_usage_present boolsubject_key_id stringauthority_key_id stringext_key_usage []intext_key_usage_present boolhas_unknown_ext_key_usage boolpermitted_dns_domains []stringexcluded_dns_domains []stringpermitted_ip_ranges []stringexcluded_ip_ranges []stringname_constraints_present boolname_constraints_unsupported boolcertificate_policies []stringcertificate_policies_present boolpolicy_mapping_issuers []stringpolicy_mapping_subjects []stringpolicy_mappings_present boolrequire_explicit_policy intinhibit_policy_mapping intpolicy_constraints_present boolinhibit_any_policy intinhibit_any_policy_present boolhas_unhandled_critical_extension booldns_names []stringip_addresses []stringstruct CertPoolpub struct CertPool {
pub certs []Certificate
}X509 Connection pool manager scheduling reusable socket connections.
certs []Certificatestruct VerifyOptionspub struct VerifyOptions {
pub dns_name string
pub current_time time.Time
pub roots CertPool
pub intermediates CertPool
pub key_usages []int
pub certificate_policies []string
pub revocation_lists []string
pub revocation_mode int
}X509 Configuration parameters and options set.
dns_name stringcurrent_time time.Timeroots CertPoolintermediates CertPoolkey_usages []intcertificate_policies []stringrevocation_lists []stringrevocation_mode intnew_cert_poolpub fn new_cert_pool() CertPoolConstruct cert pool.
No arguments are required.
CertPool — a value of this type
($&CertPool) addpub fn (p $&CertPool) add(c Certificate)Operation on $&CertPool: add.
p $&CertPoolCertPool instance used by this call (exclusive borrow).c CertificateThis call does not return a value.
append_certificatespub fn append_certificates(p $&CertPool, pem_data &string) intappend_certificates adds every CERTIFICATE PEM block that can be parsed. Unknown or malformed blocks are skipped, matching the useful part of AppendCertsFromPEM contract while keeping the subset's explicit count for diagnostics. The scanner keeps an offset into the original bundle and only copies one PEM block at a time. In particular, it does not repeatedly copy encoding/pem.Block.rest, which would make large system bundles quadratic.
p $&CertPoolpem_data &stringint — a value of this type
(&CertPool) clonepub fn (p &CertPool) clone() CertPoolOperation on &CertPool: copy into a new independent string.
p &CertPoolCertPool instance used by this call (borrow).CertPool — a value of this type
system_cert_poolpub fn system_cert_pool() CertPoolsystem_cert_pool probes the environment override first, then the native platform trust source, then conventional Unix PEM bundles and CA directories. The native adapter only supplies opaque DER records; parsing and trust policy remain in this package. An empty pool is returned when no source is readable, so TLS callers fail closed instead of silently disabling verification.
No arguments are required.
CertPool — a value of this type
parse_certificatepub fn parse_certificate(der string) CertificateParse as certificate. Throws on failure; handle the error or propagate it to the caller.
der stringCertificate — a value of this type
(&Certificate) check_signaturepub fn (c &Certificate) check_signature(algo int, signed &string, signature &string) intOperation on &Certificate: check signature. Throws on failure; handle the error or propagate it to the caller.
c &CertificateCertificate instance used by this call (borrow).algo intsigned &stringsignature &stringint — a value of this type
(&Certificate) check_signature_frompub fn (c &Certificate) check_signature_from(parent &Certificate) intOperation on &Certificate: check signature from. Throws on failure; handle the error or propagate it to the caller.
c &CertificateCertificate instance used by this call (borrow).parent &Certificateint — a value of this type
(&Certificate) match_hostpub fn (c &Certificate) match_host(host string) boolOperation on &Certificate: match host.
c &CertificateCertificate instance used by this call (borrow).host stringbool — true or false
(&Certificate) verify_with_poolspub fn (c &Certificate) verify_with_pools(dns_name string, current_time time.Time, roots &CertPool, intermediates &CertPool) intOperation on &Certificate: verify with pools. Throws on failure; handle the error or propagate it to the caller.
c &CertificateCertificate instance used by this call (borrow).dns_name stringcurrent_time time.Timeroots &CertPoolintermediates &CertPoolint — a value of this type
(&Certificate) verify_optionspub fn (c &Certificate) verify_options(opts &VerifyOptions) intverify_options borrows reusable verification inputs. This is the preferred form for callers that validate repeatedly against one pool or CRL set. Throws on failure; handle the error or propagate it to the caller.
c &CertificateCertificate instance used by this call (borrow).opts &VerifyOptionsint — a value of this type
(&Certificate) verifypub fn (c &Certificate) verify(opts VerifyOptions) intverify retains the original consuming API for source compatibility.
c &CertificateCertificate instance used by this call (borrow).opts VerifyOptionsint — a value of this type
const EXT_KEY_USAGE_ANYpub const EXT_KEY_USAGE_ANY = 0ExtendedKeyUsage values match crypto/x509 where the API overlaps.
const EXT_KEY_USAGE_SERVER_AUTHpub const EXT_KEY_USAGE_SERVER_AUTH = 1Constant EXT_KEY_USAGE_SERVER_AUTH, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_CLIENT_AUTHpub const EXT_KEY_USAGE_CLIENT_AUTH = 2Constant EXT_KEY_USAGE_CLIENT_AUTH, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_CODE_SIGNINGpub const EXT_KEY_USAGE_CODE_SIGNING = 3Constant EXT_KEY_USAGE_CODE_SIGNING, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_EMAIL_PROTECTIONpub const EXT_KEY_USAGE_EMAIL_PROTECTION = 4Constant EXT_KEY_USAGE_EMAIL_PROTECTION, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_IPSEC_END_SYSTEMpub const EXT_KEY_USAGE_IPSEC_END_SYSTEM = 5Constant EXT_KEY_USAGE_IPSEC_END_SYSTEM, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_IPSEC_TUNNELpub const EXT_KEY_USAGE_IPSEC_TUNNEL = 6Constant EXT_KEY_USAGE_IPSEC_TUNNEL, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_IPSEC_USERpub const EXT_KEY_USAGE_IPSEC_USER = 7Constant EXT_KEY_USAGE_IPSEC_USER, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_TIME_STAMPINGpub const EXT_KEY_USAGE_TIME_STAMPING = 8Constant EXT_KEY_USAGE_TIME_STAMPING, defining protocol or algorithm parameters.
const EXT_KEY_USAGE_OCSP_SIGNINGpub const EXT_KEY_USAGE_OCSP_SIGNING = 9Constant EXT_KEY_USAGE_OCSP_SIGNING, defining protocol or algorithm parameters.
const REVOCATION_OFFpub const REVOCATION_OFF = 0Constant REVOCATION_OFF, defining protocol or algorithm parameters.
const REVOCATION_IF_PRESENTpub const REVOCATION_IF_PRESENT = 1Constant REVOCATION_IF_PRESENT, defining protocol or algorithm parameters.
const REVOCATION_REQUIREpub const REVOCATION_REQUIRE = 2Constant REVOCATION_REQUIRE, defining protocol or algorithm parameters.
struct RevocationListpub struct RevocationList {
pub raw string
pub raw_tbs string
pub raw_issuer string
pub signature string
pub signature_algorithm int
pub this_update time.Time
pub next_update time.Time
pub next_update_present bool
pub authority_key_id string
pub number int
pub revoked_serials []string
pub has_unhandled_critical_extension bool
}Structure encapsulating raw, raw_tbs, raw_issuer, signature, signature_algorithm.
raw stringraw_tbs stringraw_issuer stringsignature stringsignature_algorithm intthis_update time.Timenext_update time.Timenext_update_present boolauthority_key_id stringnumber intrevoked_serials []stringhas_unhandled_critical_extension boolparse_revocation_listpub fn parse_revocation_list(der string) RevocationListParse as revocation list. Throws on failure; handle the error or propagate it to the caller.
der stringRevocationList — a value of this type