update package
This commit is contained in:
29
signature.go
29
signature.go
@@ -11,6 +11,21 @@ type Method struct {
|
||||
Algorithm string `xml:",attr"`
|
||||
}
|
||||
|
||||
// Reference data struct
|
||||
type Reference struct {
|
||||
URI string `xml:"URI,attr"`
|
||||
ReferenceTransforms []Method `xml:"Transforms>Transform"`
|
||||
DigestMethod Method `xml:"DigestMethod"`
|
||||
DigestValue string `xml:"DigestValue"`
|
||||
}
|
||||
|
||||
// SignedInfo struct
|
||||
type SignedInfo struct {
|
||||
CanonicalizationMethod Method `xml:"CanonicalizationMethod"`
|
||||
SignatureMethod Method `xml:"SignatureMethod"`
|
||||
Reference Reference `xml:"Reference"`
|
||||
}
|
||||
|
||||
// Signature is a model for the Signature object specified by XMLDSIG. This is
|
||||
// convenience object when constructing XML that you'd like to sign. For example:
|
||||
//
|
||||
@@ -24,17 +39,7 @@ type Method struct {
|
||||
// buf, _ := xml.Marshal(f)
|
||||
// buf, _ = Sign(key, buf)
|
||||
//
|
||||
type Reference struct {
|
||||
URI string `xml:",attr"`
|
||||
Transforms []Method `xml:"Transforms>Transform"`
|
||||
DigestMethod Method
|
||||
DigestValue string
|
||||
}
|
||||
type SignedInfo struct {
|
||||
CanonicalizationMethod Method `xml:"CanonicalizationMethod"`
|
||||
SignatureMethod Method `xml:"SignatureMethod"`
|
||||
Reference Reference
|
||||
}
|
||||
|
||||
type Signature struct {
|
||||
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Signature"`
|
||||
SignedInfo SignedInfo
|
||||
@@ -65,7 +70,7 @@ func DefaultSignature(pemEncodedPublicKey []byte) Signature {
|
||||
},
|
||||
Reference: Reference{
|
||||
Transforms: []Method{
|
||||
Method{Algorithm: "http://www.w3.org/2000/09/xmldsig#enveloped-signature"},
|
||||
{Algorithm: "http://www.w3.org/2000/09/xmldsig#enveloped-signature"},
|
||||
},
|
||||
DigestMethod: Method{
|
||||
Algorithm: "http://www.w3.org/2000/09/xmldsig#sha1",
|
||||
|
||||
Reference in New Issue
Block a user