本文整理汇总了Golang中github.com/letsencrypt/boulder/core.CertificateAuthority类的典型用法代码示例。如果您正苦于以下问题:Golang CertificateAuthority类的具体用法?Golang CertificateAuthority怎么用?Golang CertificateAuthority使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CertificateAuthority类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: NewCertificateAuthorityServer
// NewCertificateAuthorityServer constructs an RPC server
//
// CertificateAuthorityClient / Server
// -> IssueCertificate
func NewCertificateAuthorityServer(rpc Server, impl core.CertificateAuthority) (err error) {
rpc.Handle(MethodIssueCertificate, func(req []byte) (response []byte, err error) {
var icReq issueCertificateRequest
err = json.Unmarshal(req, &icReq)
if err != nil {
// AUDIT[ Improper Messages ] 0786b6f2-91ca-4f48-9883-842a19084c64
improperMessage(MethodIssueCertificate, err, req)
return
}
csr, err := x509.ParseCertificateRequest(icReq.Bytes)
if err != nil {
// AUDIT[ Improper Messages ] 0786b6f2-91ca-4f48-9883-842a19084c64
improperMessage(MethodIssueCertificate, err, req)
return
}
cert, err := impl.IssueCertificate(*csr, icReq.RegID)
if err != nil {
return
}
response, err = json.Marshal(cert)
if err != nil {
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
errorCondition(MethodGetRegistration, err, req)
return
}
return
})
rpc.Handle(MethodGenerateOCSP, func(req []byte) (response []byte, err error) {
var xferObj core.OCSPSigningRequest
err = json.Unmarshal(req, &xferObj)
if err != nil {
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
errorCondition(MethodGenerateOCSP, err, req)
return
}
response, err = impl.GenerateOCSP(xferObj)
if err != nil {
return
}
return
})
return nil
}
开发者ID:BergkristalQuantumLabs,项目名称:boulder,代码行数:55,代码来源:rpc-wrappers.go
示例2: NewCertificateAuthorityServer
// NewCertificateAuthorityServer constructs an RPC server
//
// CertificateAuthorityClient / Server
// -> IssueCertificate
func NewCertificateAuthorityServer(rpc Server, impl core.CertificateAuthority) (err error) {
rpc.Handle(MethodIssueCertificate, func(ctx context.Context, req []byte) (response []byte, err error) {
var icReq issueCertificateRequest
err = json.Unmarshal(req, &icReq)
if err != nil {
improperMessage(MethodIssueCertificate, err, req)
return
}
csr, err := x509.ParseCertificateRequest(icReq.Bytes)
if err != nil {
improperMessage(MethodIssueCertificate, err, req)
return
}
cert, err := impl.IssueCertificate(ctx, *csr, icReq.RegID)
if err != nil {
return
}
response, err = json.Marshal(cert)
if err != nil {
errorCondition(MethodIssueCertificate, err, req)
return
}
return
})
rpc.Handle(MethodGenerateOCSP, func(ctx context.Context, req []byte) (response []byte, err error) {
var xferObj core.OCSPSigningRequest
err = json.Unmarshal(req, &xferObj)
if err != nil {
errorCondition(MethodGenerateOCSP, err, req)
return
}
response, err = impl.GenerateOCSP(ctx, xferObj)
if err != nil {
return
}
return
})
return nil
}
开发者ID:jfrazelle,项目名称:boulder,代码行数:51,代码来源:rpc-wrappers.go
示例3: NewCertificateAuthorityServer
// CertificateAuthorityClient / Server
// -> IssueCertificate
func NewCertificateAuthorityServer(serverQueue string, channel *amqp.Channel, impl core.CertificateAuthority) (rpc *AmqpRPCServer, err error) {
rpc = NewAmqpRPCServer(serverQueue, channel)
rpc.Handle(MethodIssueCertificate, func(req []byte) []byte {
var icReq struct {
Bytes []byte
RegID int64
}
err := json.Unmarshal(req, &icReq)
if err != nil {
return nil
}
csr, err := x509.ParseCertificateRequest(icReq.Bytes)
if err != nil {
// AUDIT[ Improper Messages ] 0786b6f2-91ca-4f48-9883-842a19084c64
improperMessage(MethodIssueCertificate, err, req)
return nil // XXX
}
cert, err := impl.IssueCertificate(*csr, icReq.RegID)
if err != nil {
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
errorCondition(MethodIssueCertificate, err, csr)
return nil // XXX
}
serialized, err := json.Marshal(cert)
if err != nil {
return nil // XXX
}
return serialized
})
rpc.Handle(MethodRevokeCertificateCA, func(req []byte) []byte {
if err := impl.RevokeCertificate(string(req)); err != nil {
// AUDIT[ Error Conditions ] 9cc4d537-8534-4970-8665-4b382abe82f3
errorCondition(MethodRevokeCertificateCA, err, req)
}
return nil
})
return
}
开发者ID:hildjj,项目名称:boulder,代码行数:48,代码来源:rpc-wrappers.go
注:本文中的github.com/letsencrypt/boulder/core.CertificateAuthority类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论