?
This document uses PHP Chinese website manual Release
import "crypto/x509/pkix"
概述
索引
如果c是指定主機的有效證書,則 VerifyHostname 返回 nil。否則,它會返回描述不匹配的錯誤。
type AlgorithmIdentifier
type AttributeTypeAndValue
type AttributeTypeAndValueSET
type CertificateList
CertificateRequest 表示 PKCS#10,證書簽名請求。
type CertificateRequest struct { Raw []byte // 完整的ASN.1 DER內容(CSR,簽名算法和簽名)。 RawTBSCertificateRequest []byte // 證書請求信息是原始ASN.1 DER內容的一部分。 RawSubjectPublicKeyInfo []byte // DER編碼的SubjectPublicKeyInfo。 RawSubject []byte // DER編碼主題。 Version int Signature []byte SignatureAlgorithm SignatureAlgorithm PublicKeyAlgorithm PublicKeyAlgorithm PublicKey interface{} Subject pkix.Name // 屬性是bugs的干燥外殼,不應使用。 Attributes []pkix.AttributeTypeAndValueSET // 擴展包含原始X.509擴展。 解析CSR時,這個 // 可用于提取未解析的擴展 // 包。 Extensions []pkix.Extension // ExtraExtensions包含要復制的原始擴展名 // marshaled CSR。 值會覆蓋否則將覆蓋的任何擴展 // 基于其他領域產出,但被任何領域覆蓋 // 在Attributes中指定的擴展名。 // // 解析CSR時未填充ExtraExtensions字段,請參閱 // Extensions。 ExtraExtensions []pkix.Extension // 主題備用名稱值。 DNSNames []string EmailAddresses []string IPAddresses []net.IP}
func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error)
ParseCertificateRequest 解析來自給定 ASN.1 DER 數據的單個證書請求。
func (c *CertificateRequest) CheckSignature() error
CheckSignature 報告c上的簽名是否有效。
當證書不允許請求的使用情況時,會導致 ConstraintViolationError。例如:在公鑰不是證書簽名密鑰時檢查簽名。
type ConstraintViolationError struct{}
func (ConstraintViolationError) Error() string
ExtKeyUsage 表示對給定鍵有效的一組擴展操作。每個 ExtKeyUsage* 常量定義一個獨特的動作。
type ExtKeyUsage int
const ( ExtKeyUsageAny ExtKeyUsage = iota ExtKeyUsageServerAuth ExtKeyUsageClientAuth ExtKeyUsageCodeSigning ExtKeyUsageEmailProtection ExtKeyUsageIPSECEndSystem ExtKeyUsageIPSECTunnel ExtKeyUsageIPSECUser ExtKeyUsageTimeStamping ExtKeyUsageOCSPSigning ExtKeyUsageMicrosoftServerGatedCrypto ExtKeyUsageNetscapeServerGatedCrypto)
HostnameError 在授權名稱集與請求名稱不匹配時產生。
type HostnameError struct { Certificate *Certificate Host string}
func (h HostnameError) Error() string
一個 InsecureAlgorithmError
type InsecureAlgorithmError SignatureAlgorithm
func (e InsecureAlgorithmError) Error() string
type InvalidReason int
const ( // 當另一個證書簽署證書時,NotAuthorizedToSign會生成結果 // 未標記為CA證書。 NotAuthorizedToSign InvalidReason = iota // 證書過期時根據時間過期的結果 // 在VerifyOptions中給出。 Expired // 當中間或根時,結果為CANotAuthorizedForThisName // certificate具有名稱約束,不包括名稱 // 被檢查。 CANotAuthorizedForThisName // 當路徑長度約束為時,TooManyIntermediates結果 // 被侵犯。 TooManyIntermediates // 證書的密鑰用法表示不兼容的使用結果 // 它可能只用于不同的目的。 IncompatibleUsage // 當父證書的主題名稱時,NameMismatch結果 // 與子項中的頒發(fā)者名稱不匹配。 NameMismatch)
KeyUsage 表示對給定密鑰有效的一組操作。這是一個 KeyUsage* 常量的位圖。
type KeyUsage int
const ( KeyUsageDigitalSignature KeyUsage = 1 << iota KeyUsageContentCommitment KeyUsageKeyEncipherment KeyUsageDataEncipherment KeyUsageKeyAgreement KeyUsageCertSign KeyUsageCRLSign KeyUsageEncipherOnly KeyUsageDecipherOnly)
type PEMCipher int
EncryptPEMBlock 加密算法的可能值。
const ( PEMCipherDES PEMCipher PEMCipher3DES PEMCipherAES128 PEMCipherAES192 PEMCipherAES256)
type PublicKeyAlgorithm int
const ( UnknownPublicKeyAlgorithm PublicKeyAlgorithm = iota RSA DSA ECDSA)
type SignatureAlgorithm int
const ( UnknownSignatureAlgorithm SignatureAlgorithm = iota MD2WithRSA MD5WithRSA SHA1WithRSA SHA256WithRSA SHA384WithRSA SHA512WithRSA DSAWithSHA1 DSAWithSHA256 ECDSAWithSHA1 ECDSAWithSHA256 ECDSAWithSHA384 ECDSAWithSHA512 SHA256WithRSAPSS SHA384WithRSAPSS SHA512WithRSAPSS)