const UNKNOWN_SIGNATURE_ALGORITHM
pub const UNKNOWN_SIGNATURE_ALGORITHM = 0用途
常量 UNKNOWN_SIGNATURE_ALGORITHM,定义了相关的协议或算法配置参数。
#crypto/x509解析证书与验签(Ed25519、RSA SHA-256、SM2-with-SM3)。无签发。
const UNKNOWN_SIGNATURE_ALGORITHMpub const UNKNOWN_SIGNATURE_ALGORITHM = 0常量 UNKNOWN_SIGNATURE_ALGORITHM,定义了相关的协议或算法配置参数。
const MD5_WITH_RSApub const MD5_WITH_RSA = 2常量 MD5_WITH_RSA,定义了相关的协议或算法配置参数。
const SHA1_WITH_RSApub const SHA1_WITH_RSA = 3常量 SHA1_WITH_RSA,定义了相关的协议或算法配置参数。
const SHA256_WITH_RSApub const SHA256_WITH_RSA = 4常量 SHA256_WITH_RSA,定义了相关的协议或算法配置参数。
const SHA384_WITH_RSApub const SHA384_WITH_RSA = 5常量 SHA384_WITH_RSA,定义了相关的协议或算法配置参数。
const SHA512_WITH_RSApub const SHA512_WITH_RSA = 6常量 SHA512_WITH_RSA,定义了相关的协议或算法配置参数。
const ECDSA_WITH_SHA256pub const ECDSA_WITH_SHA256 = 10常量 ECDSA_WITH_SHA256,定义了相关的协议或算法配置参数。
const ECDSA_WITH_SHA384pub const ECDSA_WITH_SHA384 = 11常量 ECDSA_WITH_SHA384,定义了相关的协议或算法配置参数。
const ECDSA_WITH_SHA512pub const ECDSA_WITH_SHA512 = 12常量 ECDSA_WITH_SHA512,定义了相关的协议或算法配置参数。
const PURE_ED25519pub const PURE_ED25519 = 16常量 PURE_ED25519,定义了相关的协议或算法配置参数。
const SM2_WITH_SM3pub const SM2_WITH_SM3 = 20常量 SM2_WITH_SM3,定义了相关的协议或算法配置参数。
const UNKNOWN_PUBLIC_KEY_ALGORITHMpub const UNKNOWN_PUBLIC_KEY_ALGORITHM = 0常量 UNKNOWN_PUBLIC_KEY_ALGORITHM,定义了相关的协议或算法配置参数。
const RSApub const RSA = 1常量 RSA,定义了相关的协议或算法配置参数。
const DSApub const DSA = 2常量 DSA,定义了相关的协议或算法配置参数。
const ECDSApub const ECDSA = 3常量 ECDSA,定义了相关的协议或算法配置参数。
const ED25519pub const ED25519 = 4常量 ED25519,定义了相关的协议或算法配置参数。
const SM2pub const SM2 = 5常量 SM2,定义了相关的协议或算法配置参数。
const KEY_USAGE_DIGITAL_SIGNATUREpub const KEY_USAGE_DIGITAL_SIGNATURE = 1常量 KEY_USAGE_DIGITAL_SIGNATURE,定义了相关的协议或算法配置参数。
const KEY_USAGE_CONTENT_COMMITMENTpub const KEY_USAGE_CONTENT_COMMITMENT = 2常量 KEY_USAGE_CONTENT_COMMITMENT,定义了相关的协议或算法配置参数。
const KEY_USAGE_KEY_ENCIPHERMENTpub const KEY_USAGE_KEY_ENCIPHERMENT = 4常量 KEY_USAGE_KEY_ENCIPHERMENT,定义了相关的协议或算法配置参数。
const KEY_USAGE_DATA_ENCIPHERMENTpub const KEY_USAGE_DATA_ENCIPHERMENT = 8常量 KEY_USAGE_DATA_ENCIPHERMENT,定义了相关的协议或算法配置参数。
const KEY_USAGE_KEY_AGREEMENTpub const KEY_USAGE_KEY_AGREEMENT = 16常量 KEY_USAGE_KEY_AGREEMENT,定义了相关的协议或算法配置参数。
const KEY_USAGE_CERT_SIGNpub const KEY_USAGE_CERT_SIGN = 32常量 KEY_USAGE_CERT_SIGN,定义了相关的协议或算法配置参数。
const KEY_USAGE_CRL_SIGNpub const KEY_USAGE_CRL_SIGN = 64常量 KEY_USAGE_CRL_SIGN,定义了相关的协议或算法配置参数。
const KEY_USAGE_ENCIPHER_ONLYpub const KEY_USAGE_ENCIPHER_ONLY = 128常量 KEY_USAGE_ENCIPHER_ONLY,定义了相关的协议或算法配置参数。
const KEY_USAGE_DECIPHER_ONLYpub const KEY_USAGE_DECIPHER_ONLY = 256常量 KEY_USAGE_DECIPHER_ONLY,定义了相关的协议或算法配置参数。
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
}承载 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 连接池管理器,并发安全地维护和调度复用套接字连接。
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 配置参数与选项集合。
dns_name stringcurrent_time time.Timeroots CertPoolintermediates CertPoolkey_usages []intcertificate_policies []stringrevocation_lists []stringrevocation_mode intnew_cert_poolpub fn new_cert_pool() CertPool构造 cert pool。
无需传入参数。
CertPool — 该类型的值
($&CertPool) addpub fn (p $&CertPool) add(c Certificate)$&CertPool 上的操作:相加。
p $&CertPoolCertPool 实例;以独占借用传入,方法可修改它,调用方仍持有实例。c Certificate不返回值。
append_certificatespub fn append_certificates(p $&CertPool, pem_data &string) int从 PEM 格式证书数据中解析出证书并追加到证书池。
p $&CertPoolpem_data &stringint — 该类型的值
(&CertPool) clonepub fn (p &CertPool) clone() CertPool&CertPool 上的操作:拷贝一份独立的 string。
p &CertPoolCertPool 实例;以只读借用传入,调用方仍持有实例。CertPool — 该类型的值
system_cert_poolpub fn system_cert_pool() CertPool加载并返回宿主操作系统的系统默认根证书池。
无需传入参数。
CertPool — 该类型的值
parse_certificatepub fn parse_certificate(der string) Certificate解析为 certificate。失败时抛出错误,调用方需处理或继续传播。
der stringCertificate — 该类型的值
(&Certificate) check_signaturepub fn (c &Certificate) check_signature(algo int, signed &string, signature &string) int&Certificate 上的操作:执行 check signature 操作。失败时抛出错误,调用方需处理或继续传播。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。algo intsigned &stringsignature &stringint — 该类型的值
(&Certificate) check_signature_frompub fn (c &Certificate) check_signature_from(parent &Certificate) int&Certificate 上的操作:执行 check signature from 操作。失败时抛出错误,调用方需处理或继续传播。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。parent &Certificateint — 该类型的值
(&Certificate) match_hostpub fn (c &Certificate) match_host(host string) bool&Certificate 上的操作:执行 match host 操作。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。host stringbool — 是否成立
(&Certificate) verify_with_poolspub fn (c &Certificate) verify_with_pools(dns_name string, current_time time.Time, roots &CertPool, intermediates &CertPool) int&Certificate 上的操作:执行 verify with pools 操作。失败时抛出错误,调用方需处理或继续传播。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。dns_name stringcurrent_time time.Timeroots &CertPoolintermediates &CertPoolint — 该类型的值
(&Certificate) verify_optionspub fn (c &Certificate) verify_options(opts &VerifyOptions) int&Certificate 上的操作:执行 verify options 操作。失败时抛出错误,调用方需处理或继续传播。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。opts &VerifyOptionsint — 该类型的值
(&Certificate) verifypub fn (c &Certificate) verify(opts VerifyOptions) int&Certificate 上的操作:校验数字签名是否有效。
c &CertificateCertificate 实例;以只读借用传入,调用方仍持有实例。opts VerifyOptionsint — 该类型的值
const EXT_KEY_USAGE_ANYpub const EXT_KEY_USAGE_ANY = 0常量 EXT_KEY_USAGE_ANY,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_SERVER_AUTHpub const EXT_KEY_USAGE_SERVER_AUTH = 1常量 EXT_KEY_USAGE_SERVER_AUTH,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_CLIENT_AUTHpub const EXT_KEY_USAGE_CLIENT_AUTH = 2常量 EXT_KEY_USAGE_CLIENT_AUTH,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_CODE_SIGNINGpub const EXT_KEY_USAGE_CODE_SIGNING = 3常量 EXT_KEY_USAGE_CODE_SIGNING,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_EMAIL_PROTECTIONpub const EXT_KEY_USAGE_EMAIL_PROTECTION = 4常量 EXT_KEY_USAGE_EMAIL_PROTECTION,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_IPSEC_END_SYSTEMpub const EXT_KEY_USAGE_IPSEC_END_SYSTEM = 5常量 EXT_KEY_USAGE_IPSEC_END_SYSTEM,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_IPSEC_TUNNELpub const EXT_KEY_USAGE_IPSEC_TUNNEL = 6常量 EXT_KEY_USAGE_IPSEC_TUNNEL,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_IPSEC_USERpub const EXT_KEY_USAGE_IPSEC_USER = 7常量 EXT_KEY_USAGE_IPSEC_USER,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_TIME_STAMPINGpub const EXT_KEY_USAGE_TIME_STAMPING = 8常量 EXT_KEY_USAGE_TIME_STAMPING,定义了相关的协议或算法配置参数。
const EXT_KEY_USAGE_OCSP_SIGNINGpub const EXT_KEY_USAGE_OCSP_SIGNING = 9常量 EXT_KEY_USAGE_OCSP_SIGNING,定义了相关的协议或算法配置参数。
const REVOCATION_OFFpub const REVOCATION_OFF = 0常量 REVOCATION_OFF,定义了相关的协议或算法配置参数。
const REVOCATION_IF_PRESENTpub const REVOCATION_IF_PRESENT = 1常量 REVOCATION_IF_PRESENT,定义了相关的协议或算法配置参数。
const REVOCATION_REQUIREpub const REVOCATION_REQUIRE = 2常量 REVOCATION_REQUIRE,定义了相关的协议或算法配置参数。
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
}承载 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) RevocationList解析为 revocation list。失败时抛出错误,调用方需处理或继续传播。
der stringRevocationList — 该类型的值