教程集 www.jiaochengji.com
教程集 >  Golang编程  >  golang教程  >  正文 Golang标准库——crypto(4)

Golang标准库——crypto(4)

发布时间:2022-02-28   编辑:jiaochengji.com
教程集为您提供Golang标准库——crypto(4)等资源,欢迎您收藏本站,我们将为您提供最新的Golang标准库——crypto(4)资源
<ul><li>x509</li> <li>x509/pkix</li> </ul><h2>x509</h2> <blockquote>

x509包解析X.509编码的证书和密钥。

</blockquote> <h3>Constants</h3> <pre><code class="lang-go hljs">const ( PEMCipherDES PEMCipher3DES PEMCipherAES128 PEMCipherAES192 PEMCipherAES256 ) </code></code></pre> <blockquote>

可能会被EncryptPEMBlock加密算法使用的值。

</blockquote> <h3>Variables</h3> <pre><code class="lang-go hljs">var ErrUnsupportedAlgorithm = errors.New("x509: cannot verify signature: algorithm unimplemented") </code></code></pre> <blockquote>

当试图执行包含目前未实现的算法的操作时,会返回ErrUnsupportedAlgorithm。

</blockquote> <pre><code class="lang-go hljs">var IncorrectPasswordError = errors.New("x509: decryption password incorrect") </code></code></pre> <blockquote>

当检测到不正确的密码时,会返回IncorrectPasswordError。

</blockquote> <h3>type PEMCipher</h3> <pre><code class="lang-go hljs">type PEMCipher int </code></code></pre> <h3>type PublicKeyAlgorithm</h3> <pre><code class="lang-go hljs">type PublicKeyAlgorithm int const ( UnknownPublicKeyAlgorithm PublicKeyAlgorithm = iota RSA DSA ECDSA ) </code></code></pre> <h3>type SignatureAlgorithm</h3> <pre><code class="lang-go hljs">type SignatureAlgorithm int const ( UnknownSignatureAlgorithm SignatureAlgorithm = iota MD2WithRSA MD5WithRSA SHA1WithRSA SHA256WithRSA SHA384WithRSA SHA512WithRSA DSAWithSHA1 DSAWithSHA256 ECDSAWithSHA1 ECDSAWithSHA256 ECDSAWithSHA384 ECDSAWithSHA512 ) </code></code></pre> <h3>type SystemRootsError</h3> <pre><code class="lang-go hljs">type SystemRootsError struct { Err error } </code></code></pre> <blockquote>

当从系统装载根证书失败时,会返回SystemRootsError。

</blockquote> <h4>func (SystemRootsError) Error</h4> <pre><code class="lang-go hljs">func (e SystemRootsError) Error() string </code></code></pre> <h3>type HostnameError</h3> <pre><code class="lang-go hljs">type HostnameError struct { Certificate *Certificate Host string } </code></code></pre> <blockquote>

当认证的名字和请求的名字不匹配时,会返回HostnameError。

</blockquote> <h4>func (HostnameError) Error</h4> <pre><code class="lang-go hljs">func (h HostnameError) Error() string </code></code></pre> <h3>type UnknownAuthorityError</h3> <pre><code class="lang-go hljs">type UnknownAuthorityError struct { Cert *Certificate // hintErr contains an error that may be helpful in determining why an // authority wasn't found. hintErr error // hintCert contains a possible authority certificate that was rejected // because of the error in hintErr. hintCert *Certificate } </code></code></pre> <blockquote>

当证书的发布者未知时,会返回UnknownAuthorityError。

</blockquote> <h4>func (UnknownAuthorityError) Error</h4> <pre><code class="lang-go hljs">func (e UnknownAuthorityError) Error() string </code></code></pre> <h3>type ConstraintViolationError</h3> <pre><code class="lang-go hljs">type ConstraintViolationError struct{} </code></code></pre> <blockquote>

当请求的用途不被证书许可时,会返回ConstraintViolationError。如:当公钥不是证书的签名密钥时用它检查签名。

</blockquote> <h4>func (ConstraintViolationError) Error</h4> <pre><code class="lang-go hljs">func (ConstraintViolationError) Error() string </code></code></pre> <h3>type UnhandledCriticalExtension</h3> <pre><code class="lang-go hljs">type UnhandledCriticalExtension struct{} </code></code></pre> <h4>func (UnhandledCriticalExtension) Error</h4> <pre><code class="lang-go hljs">func (h UnhandledCriticalExtension) Error() string </code></code></pre> <h3>type CertificateInvalidError</h3> <pre><code class="lang-go hljs">type CertificateInvalidError struct { Cert *Certificate Reason InvalidReason } </code></code></pre> <blockquote>

当发生其余的错误时,会返回CertificateInvalidError。本包的使用者可能会想统一处理所有这类错误。

</blockquote> <h4>func (CertificateInvalidError) Error</h4> <pre><code class="lang-go hljs">func (e CertificateInvalidError) Error() string </code></code></pre> <h3>type KeyUsage</h3> <pre><code class="lang-go hljs">type KeyUsage int </code></code></pre> <blockquote>

KeyUsage代表给定密钥的合法操作集。用KeyUsage类型常数的位图表示。(字位表示有无)

</blockquote> <pre><code class="lang-go hljs">const ( KeyUsageDigitalSignature KeyUsage = 1 << iota KeyUsageContentCommitment KeyUsageKeyEncipherment KeyUsageDataEncipherment KeyUsageKeyAgreement KeyUsageCertSign KeyUsageCRLSign KeyUsageEncipherOnly KeyUsageDecipherOnly ) </code></code></pre> <h3>type ExtKeyUsage</h3> <pre><code class="lang-go hljs">type ExtKeyUsage int </code></code></pre> <blockquote>

ExtKeyUsage代表给定密钥的合法操作扩展集。每一个ExtKeyUsage类型常数定义一个特定的操作。

</blockquote> <pre><code class="lang-go hljs">const ( ExtKeyUsageAny ExtKeyUsage = iota ExtKeyUsageServerAuth ExtKeyUsageClientAuth ExtKeyUsageCodeSigning ExtKeyUsageEmailProtection ExtKeyUsageIPSECEndSystem ExtKeyUsageIPSECTunnel ExtKeyUsageIPSECUser ExtKeyUsageTimeStamping ExtKeyUsageOCSPSigning ExtKeyUsageMicrosoftServerGatedCrypto ExtKeyUsageNetscapeServerGatedCrypto ) </code></code></pre> <h3>type VerifyOptions</h3> <pre><code class="lang-go hljs">type VerifyOptions struct { DNSName string Intermediates *CertPool Roots *CertPool // 如为nil,将使用系统根证书池 CurrentTime time.Time // 如为零值,将使用当前时间 // KeyUsage指定了可以接受哪些密钥扩展用途,空列表代表ExtKeyUsageServerAuth。 // 密钥用途被作为生成证书链的限制条件(类似Windows加密应用程序接口的行为,但不完全一样) // 要接受任何密钥用途,可以使本字段包含ExtKeyUsageAny。 KeyUsages []ExtKeyUsage } </code></code></pre> <blockquote>

VerifyOptions包含提供给Certificate.Verify方法的参数。它是结构体类型,因为其他PKIX认证API需要很长参数。

</blockquote> <h3>type InvalidReason</h3> <pre><code class="lang-go hljs">type InvalidReason int const ( // NotAuthorizedToSign表示给本证书签名的证书不是CA证书 NotAuthorizedToSign InvalidReason = iota // Expired表示证书已过期,根据VerifyOptions.CurrentTime判断 Expired // CANotAuthorizedForThisName表示中间证书或根证书具有名字限制,且不包含被检查的名字 CANotAuthorizedForThisName // TooManyIntermediates表示违反了路径长度限制 TooManyIntermediates // IncompatibleUsage表示证书的密钥用途显示它只能用于其它目的 IncompatibleUsage ) </code></code></pre> <h3>type Certificate</h3> <pre><code class="lang-go hljs">type Certificate struct { Raw []byte // 原始、完整的ASN.1 DER内容(证书、签名算法、签名) RawTBSCertificate []byte // ASN.1 DER 内容的证书部分 RawSubjectPublicKeyInfo []byte // 原始DER编码的SubjectPublicKeyInfo RawSubject []byte // 原始DER编码的Subject RawIssuer []byte // 原始DER编码的Issuer Signature []byte SignatureAlgorithm SignatureAlgorithm PublicKeyAlgorithm PublicKeyAlgorithm PublicKey interface{} Version int SerialNumber *big.Int Issuer pkix.Name Subject pkix.Name NotBefore, NotAfter time.Time // 有效期前后界,本时间段之外无效 KeyUsage KeyUsage // Extensions保管原始的X.509扩展。当解析证书时,本字段用于摘录本包未解析的不关键扩展。 // 序列化证书时,Extensions字段会被忽略,参见ExtraExtensions。 Extensions []pkix.Extension // ExtraExtensions包含应被直接拷贝到任何序列化的证书中的扩展。 // 本字段保管的值会覆盖任何其它字段生成的扩展。 // ExtraExtensions字段在解析证书时不会被填写,参见Extensions。 ExtraExtensions []pkix.Extension ExtKeyUsage []ExtKeyUsage // 密钥扩展用途的序列 UnknownExtKeyUsage []asn1.ObjectIdentifier // 遇到的本包不能识别的密钥扩展用途 BasicConstraintsValid bool // 如果下两个字段合法,将为真 IsCA bool MaxPathLen int SubjectKeyId []byte AuthorityKeyId []byte // RFC 5280, 4.2.2.1(认证信息存取) OCSPServer []string IssuingCertificateURL []string // 证书持有者的替用名称 DNSNames []string EmailAddresses []string IPAddresses []net.IP // 名称的约束 PermittedDNSDomainsCritical bool // 如为真则名称约束被标记为关键的 PermittedDNSDomains []string // CRL配销点 CRLDistributionPoints []string PolicyIdentifiers []asn1.ObjectIdentifier } </code></code></pre> <blockquote>

Certificate代表一个X.509证书。

</blockquote> <h4>func (*Certificate) CheckSignatureFrom</h4> <pre><code class="lang-go hljs">func (c *Certificate) CheckSignatureFrom(parent *Certificate) (err error) </code></code></pre> <blockquote>

CheckSignatureFrom检查c中的签名是否是来自parent的合法签名。

</blockquote> <h4>func (*Certificate) CheckCRLSignature</h4> <pre><code class="lang-go hljs">func (c *Certificate) CheckCRLSignature(crl *pkix.CertificateList) (err error) </code></code></pre> <blockquote>

CheckCRLSignature检查crl中的签名是否来自c。

</blockquote> <h4>func (*Certificate) CheckSignature</h4> <pre><code class="lang-go hljs">func (c *Certificate) CheckSignature(algo SignatureAlgorithm, signed, signature []byte) (err error) </code></code></pre> <blockquote>

CheckSignature检查signature是否是c的公钥生成的signed的合法签名。

</blockquote> <h4>func (*Certificate) CreateCRL</h4> <pre><code class="lang-go hljs">func (c *Certificate) CreateCRL(rand io.Reader, priv interface{}, revokedCerts []pkix.RevokedCertificate, now, expiry time.Time) (crlBytes []byte, err error) </code></code></pre> <blockquote>

CreateCRL返回一个DER编码的CRL(证书注销列表),使用c签名,并包含给出的已取消签名列表。

只支持RSA类型的密钥(priv参数必须是*rsa.PrivateKey类型)。

</blockquote> <h4>func (*Certificate) Equal</h4> <pre><code class="lang-go hljs">func (c *Certificate) Equal(other *Certificate) bool </code></code></pre> <h4>func (*Certificate) Verify</h4> <pre><code class="lang-go hljs">func (c *Certificate) Verify(opts VerifyOptions) (chains [][]*Certificate, err error) </code></code></pre> <blockquote>

Verify通过创建一到多个从c到opts.Roots中的证书的链条来认证c,如有必要会使用opts.Intermediates中的证书。如果成功,它会返回一到多个证书链条,每一条都以c开始,以opts.Roots中的证书结束。

警告:它不会做任何取消检查。

</blockquote> <h4>func (*Certificate) VerifyHostname</h4> <pre><code class="lang-go hljs">func (c *Certificate) VerifyHostname(h string) error </code></code></pre> <blockquote>

如果c是名为h的主机的合法证书,VerifyHostname会返回真;否则它返回一个描述该不匹配情况的错误。

</blockquote> <h3>type CertPool</h3> <pre><code class="lang-go hljs">type CertPool struct { bySubjectKeyId map[string][]int byName map[string][]int certs []*Certificate } </code></code></pre> <blockquote>

CertPool代表一个证书集合/证书池。

</blockquote> <h4>func NewCertPool</h4> <pre><code class="lang-go hljs">func NewCertPool() *CertPool </code></code></pre> <blockquote>

NewCertPool创建一个新的、空的CertPool。

</blockquote> <h4>func (*CertPool) AddCert</h4> <pre><code class="lang-go hljs">func (s *CertPool) AddCert(cert *Certificate) </code></code></pre> <blockquote>

AddCert向s中添加一个证书。

</blockquote> <h4>func (*CertPool) AppendCertsFromPEM</h4> <pre><code class="lang-go hljs">func (s *CertPool) AppendCertsFromPEM(pemCerts []byte) (ok bool) </code></code></pre> <blockquote>

AppendCertsFromPEM试图解析一系列PEM编码的证书。它将找到的任何证书都加入s中,如果所有证书都成功被解析,会返回真。

在许多Linux系统中,/etc/ssl/cert.pem会包含适合本函数的大量系统级根证书。

</blockquote> <h4>func (*CertPool) Subjects</h4> <pre><code class="lang-go hljs">func (s *CertPool) Subjects() (res [][]byte) </code></code></pre> <blockquote>

Subjects返回池中所有证书的DER编码的持有者的列表。

</blockquote> <h3>type CertificateRequest</h3> <pre><code class="lang-go hljs">type CertificateRequest struct { Raw []byte // 原始、完整的ASN.1 DER内容(CSR、签名算法、签名) RawTBSCertificateRequest []byte // ASN.1 DER 内容的证书请求信息 RawSubjectPublicKeyInfo []byte // 原始DER编码的SubjectPublicKeyInfo RawSubject []byte // 原始DER编码的Subject Version int Signature []byte SignatureAlgorithm SignatureAlgorithm PublicKeyAlgorithm PublicKeyAlgorithm PublicKey interface{} Subject pkix.Name // Attributes提供关于证书持有者的额外信息,参见RFC 2986 section 4.1。 Attributes []pkix.AttributeTypeAndValueSET // Extensions保管原始的X.509扩展。当解析CSR时,本字段用于摘录本包未解析的不关键扩展。 Extensions []pkix.Extension // ExtraExtensions包含应被直接拷贝到任何序列化的CSR中的扩展。 // 本字段保管的值会覆盖任何其它字段生成的扩展,但会被Attributes字段指定的扩展覆盖。 // ExtraExtensions字段在解析CSR时不会增加,参见Extensions。 ExtraExtensions []pkix.Extension // 证书持有者的替用名称。 DNSNames []string EmailAddresses []string IPAddresses []net.IP } </code></code></pre> <blockquote>

CertificateRequest代表一个PKCS #10证书签名请求。

</blockquote> <h3>func MarshalECPrivateKey</h3> <pre><code class="lang-go hljs">func MarshalECPrivateKey(key *ecdsa.PrivateKey) ([]byte, error) </code></code></pre> <blockquote>

MarshalECPrivateKey将ecdsa私钥序列化为ASN.1 DER编码。

</blockquote> <h3>func MarshalPKCS1PrivateKey</h3> <pre><code class="lang-go hljs">func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte </code></code></pre> <blockquote>

MarshalPKCS1PrivateKey将rsa私钥序列化为ASN.1 PKCS#1 DER编码。

</blockquote> <h3>func MarshalPKIXPublicKey</h3> <pre><code class="lang-go hljs">func MarshalPKIXPublicKey(pub interface{}) ([]byte, error) </code></code></pre> <blockquote>

MarshalPKIXPublicKey将公钥序列化为PKIX格式DER编码。

</blockquote> <h3>func ParseECPrivateKey</h3> <pre><code class="lang-go hljs">func ParseECPrivateKey(der []byte) (key *ecdsa.PrivateKey, err error) </code></code></pre> <blockquote>

ParseECPrivateKey解析ASN.1 DER编码的ecdsa私钥。

</blockquote> <h3>func ParsePKCS1PrivateKey</h3> <pre><code class="lang-go hljs">func ParsePKCS1PrivateKey(der []byte) (key *rsa.PrivateKey, err error) </code></code></pre> <blockquote>

ParsePKCS1PrivateKey解析ASN.1 PKCS#1 DER编码的rsa私钥。

</blockquote> <h3>func ParsePKCS8PrivateKey</h3> <pre><code class="lang-go hljs">func ParsePKCS8PrivateKey(der []byte) (key interface{}, err error) </code></code></pre> <blockquote>

ParsePKCS8PrivateKey解析一个未加密的PKCS#8私钥,参见http://www.rsa.com/rsalabs/node.asp?id=2130和RFC5208。

</blockquote> <h3>func ParsePKIXPublicKey</h3> <pre><code class="lang-go hljs">func ParsePKIXPublicKey(derBytes []byte) (pub interface{}, err error) </code></code></pre> <blockquote>

ParsePKIXPublicKey解析一个DER编码的公钥。这些公钥一般在以"BEGIN PUBLIC KEY"出现的PEM块中。

</blockquote> <h3>func EncryptPEMBlock</h3> <pre><code class="lang-go hljs">func EncryptPEMBlock(rand io.Reader, blockType string, data, password []byte, alg PEMCipher) (*pem.Block, error) </code></code></pre> <blockquote>

EncryptPEMBlock使用指定的密码、加密算法加密data,返回一个具有指定块类型,保管加密后数据的PEM块。

</blockquote> <h3>func IsEncryptedPEMBlock</h3> <pre><code class="lang-go hljs">func IsEncryptedPEMBlock(b *pem.Block) bool </code></code></pre> <blockquote>

IsEncryptedPEMBlock返回PEM块b是否是用密码加密了的。

</blockquote> <h3>func DecryptPEMBlock</h3> <pre><code class="lang-go hljs">func DecryptPEMBlock(b *pem.Block, password []byte) ([]byte, error) </code></code></pre> <blockquote>

DecryptPEMBlock接受一个加密后的PEM块和加密该块的密码password,返回解密后的DER编码字节切片。它会检查DEK信息头域,以确定用于解密的算法。如果b中没有DEK信息头域,会返回错误。如果函数发现密码不正确,会返回IncorrectPasswordError。

</blockquote> <h3>func ParseCRL</h3> <pre><code class="lang-go hljs">func ParseCRL(crlBytes []byte) (certList *pkix.CertificateList, err error) </code></code></pre> <blockquote>

ParseCRL从crlBytes中解析CRL(证书注销列表)。因为经常有PEM编码的CRL出现在应该是DER编码的地方,因此本函数可以透明的处理PEM编码,只要没有前导的垃圾数据。

</blockquote> <h3>func ParseDERCRL</h3> <pre><code class="lang-go hljs">func ParseDERCRL(derBytes []byte) (certList *pkix.CertificateList, err error) </code></code></pre> <blockquote>

ParseDERCRL从derBytes中解析DER编码的CRL。

</blockquote> <h3>func ParseCertificate</h3> <pre><code class="lang-go hljs">func ParseCertificate(asn1Data []byte) (*Certificate, error) </code></code></pre> <blockquote>

ParseCertificate从ASN.1 DER数据解析单个证书。

</blockquote> <h3>func ParseCertificateRequest</h3> <pre><code class="lang-go hljs">func ParseCertificateRequest(asn1Data []byte) (*CertificateRequest, error) </code></code></pre> <blockquote>

ParseCertificateRequest解析一个ASN.1 DER数据获取单个证书请求。

</blockquote> <h3>func ParseCertificates</h3> <pre><code class="lang-go hljs">func ParseCertificates(asn1Data []byte) ([]*Certificate, error) </code></code></pre> <blockquote>

ParseCertificates从ASN.1 DER编码的asn1Data中解析一到多个证书。这些证书必须是串联的,且中间没有填充。

</blockquote> <h3>func CreateCertificate</h3> <pre><code class="lang-go hljs">func CreateCertificate(rand io.Reader, template, parent *Certificate, pub interface{}, priv interface{}) (cert []byte, err error) </code></code></pre> <blockquote>

CreateCertificate基于模板创建一个新的证书。会用到模板的如下字段:

SerialNumber、Subject、NotBefore、NotAfter、KeyUsage、ExtKeyUsage、UnknownExtKeyUsage、BasicConstraintsValid、IsCA、MaxPathLen、SubjectKeyId、DNSNames、PermittedDNSDomainsCritical、PermittedDNSDomains、SignatureAlgorithm。

该证书会使用parent签名。如果parent和template相同,则证书是自签名的。Pub参数是被签名者的公钥,而priv是签名者的私钥。

返回的切片是DER编码的证书。

只支持RSA和ECDSA类型的密钥。(pub可以是<em>rsa.PublicKey或</em>ecdsa.PublicKey,priv可以是<em>rsa.PrivateKey或</em>ecdsa.PrivateKey)

</blockquote> <h3>func CreateCertificateRequest</h3> <pre><code class="lang-go hljs">func CreateCertificateRequest(rand io.Reader, template *CertificateRequest, priv interface{}) (csr []byte, err error) </code></code></pre> <blockquote>

CreateCertificateRequest基于模板创建一个新的证书请求。会用到模板的如下字段:

Subject、Attributes、Extension、SignatureAlgorithm、DNSNames、EmailAddresses、IPAddresses。

priv是签名者的私钥。返回的切片是DER编码的证书请求。

只支持RSA(<em>rsa.PrivateKey)和ECDSA(</em>ecdsa.PrivateKey)类型的密钥。

</blockquote> <h2>pkix</h2> <blockquote>

pkix包提供了共享的、低层次的结构体,用于ASN.1解析和X.509证书、CRL、OCSP的序列化。

</blockquote> <h3>type Extension</h3> <pre><code class="lang-go hljs">type Extension struct { Id asn1.ObjectIdentifier Critical bool `asn1:"optional"` Value []byte } </code></code></pre> <blockquote>

Extension代表一个同名的ASN.1结构体,参见RFC 5280, section 4.2。

</blockquote> <h3>type AlgorithmIdentifier</h3> <pre><code class="lang-go hljs">type AlgorithmIdentifier struct { Algorithm asn1.ObjectIdentifier Parameters asn1.RawValue `asn1:"optional"` } </code></code></pre> <blockquote>

AlgorithmIdentifier代表一个同名的ASN.1结构体,参见RFC 5280, section 4.1.1.2。

</blockquote> <h3>type RevokedCertificate</h3> <pre><code class="lang-go hljs">type RevokedCertificate struct { SerialNumber *big.Int RevocationTime time.Time Extensions []Extension `asn1:"optional"` } </code></code></pre> <blockquote>

RevokedCertificate代表一个同名的ASN.1结构体,参见RFC 5280, section 5.1。

</blockquote> <h3>type TBSCertificateList</h3> <pre><code class="lang-go hljs">type TBSCertificateList struct { Raw asn1.RawContent Version int `asn1:"optional,default:2"` Signature AlgorithmIdentifier Issuer RDNSequence ThisUpdate time.Time NextUpdate time.Time RevokedCertificates []RevokedCertificate `asn1:"optional"` Extensions []Extension `asn1:"tag:0,optional,explicit"` } </code></code></pre> <blockquote>

TBSCertificateList代表一个同名的ASN.1结构体,参见RFC 5280, section 5.1。

</blockquote> <h3>type AttributeTypeAndValue</h3> <pre><code class="lang-go hljs">type AttributeTypeAndValue struct { Type asn1.ObjectIdentifier Value interface{} } </code></code></pre> <blockquote>

AttributeTypeAndValue代表一个同名的ASN.1结构体,参见http://tools.ietf.org/html/rfc5280#section-4.1.2.4。

</blockquote> <h3>type AttributeTypeAndValueSET</h3> <pre><code class="lang-go hljs">type AttributeTypeAndValueSET struct { Type asn1.ObjectIdentifier Value [][]AttributeTypeAndValue `asn1:"set"` } </code></code></pre> <blockquote>

AttributeTypeAndValueSET代表AttributeTypeAndValue序列表示的ASN.1序列的集合,参见RFC 2986 (PKCS #10)。

</blockquote> <h3>type CertificateList</h3> <pre><code class="lang-go hljs">type CertificateList struct { TBSCertList TBSCertificateList SignatureAlgorithm AlgorithmIdentifier SignatureValue asn1.BitString } </code></code></pre> <blockquote>

CertificateList代表一个同名的ASN.1结构体,参见RFC 5280, section 5.1。用于认证签名。

</blockquote> <h4>func (*CertificateList) HasExpired</h4> <pre><code class="lang-go hljs">func (certList *CertificateList) HasExpired(now time.Time) bool </code></code></pre> <blockquote>

HasExpired报告证书列表是否已过期。

</blockquote> <h3>type RelativeDistinguishedNameSET</h3> <pre><code class="lang-go hljs">type RelativeDistinguishedNameSET []AttributeTypeAndValue </code></code></pre> <h3>type RDNSequence</h3> <pre><code class="lang-go hljs">type RDNSequence []RelativeDistinguishedNameSET </code></code></pre> <h3>type Name</h3> <pre><code class="lang-go hljs">type Name struct { Country, Organization, OrganizationalUnit []string Locality, Province []string StreetAddress, PostalCode []string SerialNumber, CommonName string Names []AttributeTypeAndValue } </code></code></pre> <blockquote>

Name代表一个X.509识别名。只包含识别名的公共属性,额外的属性被忽略。

</blockquote> <h4>func (*Name) FillFromRDNSequence</h4> <pre><code class="lang-go hljs">func (n *Name) FillFromRDNSequence(rdns *RDNSequence) </code></code></pre> <h4>func (Name) ToRDNSequence</h4> <pre><code class="lang-go hljs">func (n Name) ToRDNSequence() (ret RDNSequence) </code></code></pre> 到此这篇关于“ Golang标准库——crypto(4)”的文章就介绍到这了,更多文章或继续浏览下面的相关文章,希望大家以后多多支持JQ教程网!

您可能感兴趣的文章:
css中position相对定位和绝对定位(relative,absolute)详解
更改MySQL数据库名实例代码
网页标题随机显示名言js代码
linux下PostgreSQL的安装与使用
专家教你如何有效的学习Drupal - Drupal问答
js时间函数综合例子(日期计算、字符串转日期等)
php实现简单用户登录功能程序代码
PHPExcel 中文使用手册详解
PHP无限级分类菜单实例程序
PostgreSQL从菜鸟到专家系列教程(8)数据定义 字符数据类型

[关闭]
~ ~