本文整理匯總了Golang中github.com/cloudflare/cfssl/api/info.NewHandler函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewHandler函數的具體用法?Golang NewHandler怎麽用?Golang NewHandler使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewHandler函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newHandler
// newHandler generates a new sign handler (or info handler) using the certificate
// authority private key and certficate to sign certificates.
func newHandler(t *testing.T, caFile, caKeyFile, op string) (http.Handler, error) {
var expiry = 1 * time.Minute
var CAConfig = &config.Config{
Signing: &config.Signing{
Profiles: map[string]*config.SigningProfile{
"signature": &config.SigningProfile{
Usage: []string{"digital signature"},
Expiry: expiry,
},
},
Default: &config.SigningProfile{
Usage: []string{"cert sign", "crl sign"},
ExpiryString: "43800h",
Expiry: expiry,
CA: true,
UseSerialSeq: true,
},
},
}
s, err := local.NewSignerFromFile(testCaFile, testCaKeyFile, CAConfig.Signing)
if err != nil {
t.Fatal(err)
}
if op == "sign" {
return NewSignHandlerFromSigner(s)
} else if op == "info" {
return apiinfo.NewHandler(s)
}
t.Fatal("Bad op code")
return nil, nil
}
示例2: newTestInfoHandler
func newTestInfoHandler(t *testing.T, s signer.Signer) (h http.Handler) {
h, err := apiinfo.NewHandler(s)
if err != nil {
t.Fatal(err)
}
return
}
示例3:
}
return signhandler.NewHandlerFromSigner(s)
},
"authsign": func() (http.Handler, error) {
if s == nil {
return nil, errBadSigner
}
return signhandler.NewAuthHandlerFromSigner(s)
},
"info": func() (http.Handler, error) {
if s == nil {
return nil, errBadSigner
}
return info.NewHandler(s)
},
"gencrl": func() (http.Handler, error) {
if s == nil {
return nil, errBadSigner
}
return crl.NewHandler(), nil
},
"newcert": func() (http.Handler, error) {
if s == nil {
return nil, errBadSigner
}
return generator.NewCertGeneratorHandlerFromSigner(generator.CSRValidate, s), nil
},