-
Notifications
You must be signed in to change notification settings - Fork 22
/
types.go
57 lines (48 loc) · 2.34 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package xmlsig
import "encoding/xml"
/*
Data structures to represent some of the types defined in
Schema for XML Signatures, http://www.w3.org/2000/09/xmldsig.
*/
// Signature element is the root element of an XML Signature.
type Signature struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Signature"`
SignedInfo SignedInfo
SignatureValue string `xml:"http://www.w3.org/2000/09/xmldsig# SignatureValue"`
KeyInfo KeyInfo
}
// Algorithm describes the digest or signature used when digest or signature.
type Algorithm struct {
Algorithm string `xml:",attr"`
}
// SignedInfo includes a canonicalization algorithm, a signature algorithm, and a reference.
type SignedInfo struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# SignedInfo"`
CanonicalizationMethod Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# CanonicalizationMethod"`
SignatureMethod Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# SignatureMethod"`
Reference Reference
}
// Reference specifies a digest algorithm and digest value, and optionally an identifier of the object being signed, the type of the object, and/or a list of transforms to be applied prior to digesting.
type Reference struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Reference"`
URI string `xml:",attr,omitempty"`
Transforms Transforms
DigestMethod Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# DigestMethod"`
DigestValue string `xml:"http://www.w3.org/2000/09/xmldsig# DigestValue"`
}
// Transforms is an optional ordered list of processing steps that were applied to the resource's content before it was digested.
type Transforms struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Transforms"`
Transform []Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# Transform"`
}
// KeyInfo is an optional element that enables the recipient(s) to obtain the key needed to validate the signature.
type KeyInfo struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo"`
X509Data *X509Data
Children []interface{}
}
// X509Data element within KeyInfo contains one an X509 certificate
type X509Data struct {
XMLName xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# X509Data"`
X509Certificate string `xml:"http://www.w3.org/2000/09/xmldsig# X509Certificate"`
}