本文整理匯總了Golang中github.com/jlmucb/cloudproxy/go/tao.Verifier.MarshalKey方法的典型用法代碼示例。如果您正苦於以下問題:Golang Verifier.MarshalKey方法的具體用法?Golang Verifier.MarshalKey怎麽用?Golang Verifier.MarshalKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/jlmucb/cloudproxy/go/tao.Verifier
的用法示例。
在下文中一共展示了Verifier.MarshalKey方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RequestProgramCert
// This function packages a host attestation into a DomainServiceRequest of the type
// DOMAIN_CERT_REQUEST, sends it to the domain service and deserializes the response
// into an attestation that contains the domain program certificate.
func RequestProgramCert(hostAtt *tao.Attestation, verifier *tao.Verifier,
network string, addr string) (*x509.Certificate, error) {
serAtt, err := proto.Marshal(hostAtt)
if err != nil {
return nil, err
}
reqType := DomainServiceRequest_DOMAIN_CERT_REQUEST
request := &DomainServiceRequest{
Type: &reqType,
SerializedHostAttestation: serAtt,
ProgramKey: verifier.MarshalKey(),
}
conn, err := net.Dial(network, addr)
if err != nil {
return nil, err
}
ms := util.NewMessageStream(conn)
_, err = ms.WriteMessage(request)
if err != nil {
return nil, err
}
log.Printf("Sent Program cert request to Domain Service using network %s at address %s.",
network, addr)
var response DomainServiceResponse
err = ms.ReadMessage(&response)
if err != nil {
return nil, err
}
log.Println("Got response from Domain Service.")
if errStr := response.GetErrorMessage(); errStr != "" {
return nil, errors.New(errStr)
}
cert, err := x509.ParseCertificate(response.GetDerProgramCert())
if err != nil {
return nil, err
}
return cert, nil
}