Documentation ¶
Index ¶
- Variables
- func MarshalAttributes(attrs []Attribute) ([]byte, error)
- func SignData(ctx *SigningContext) ([]byte, error)
- func VerifySignature(cert *x509.Certificate, buf []byte) (bool, error)
- type Attribute
- type ContentInfo
- type IssuerAndSerial
- type RawCertificates
- type SignedData
- type SignerData
- type SignerInfo
- type SigningContext
- type SpcIndirectDataContentPe
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OIDData = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 1} OIDSignedData = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 7, 2} OIDDigestAlgorithmSHA256 = asn1.ObjectIdentifier{2, 16, 840, 1, 101, 3, 4, 2, 1} OIDEncryptionAlgorithmRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} OIDAttributeContentType = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 3} OIDAttributeMessageDigest = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 4} OIDAttributeSigningTime = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 5} // PE/COFF signing specific OIDSpcIndirectDataContent = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 2, 1, 4} OIDSpcPEImageDataObjID = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 311, 2, 1, 15} )
OID data we need
Functions ¶
func MarshalAttributes ¶
func SignData ¶
func SignData(ctx *SigningContext) ([]byte, error)
func VerifySignature ¶
func VerifySignature(cert *x509.Certificate, buf []byte) (bool, error)
Types ¶
type Attribute ¶
type Attribute struct { Type asn1.ObjectIdentifier Value asn1.RawValue `asn1:"set"` }
type ContentInfo ¶
type ContentInfo struct { Content asn1.RawContent ContentType asn1.ObjectIdentifier }
func NewContentInfo ¶
func NewContentInfo(contentType asn1.ObjectIdentifier, data interface{}) (ci ContentInfo, err error)
Create a ContentInfo structure for the given bytes or structure. data can be nil for detached signatures.
func (ContentInfo) Bytes ¶
func (ci ContentInfo) Bytes() ([]byte, error)
func (ContentInfo) Unmarshal ¶
func (ci ContentInfo) Unmarshal(dest interface{}) (err error)
Unmarshal a structure from a ContentInfo.
type IssuerAndSerial ¶
type RawCertificates ¶
type RawCertificates struct {
Raw asn1.RawContent
}
func MarshalCertificates ¶
func MarshalCertificates(certs ...*x509.Certificate) RawCertificates
dump raw certificates to structure
type SignedData ¶
type SignedData struct { ContentType asn1.ObjectIdentifier Content SignerData `asn1:"explicit,optional,tag:0"` }
func ParseSignature ¶
func ParseSignature(buf []byte) *SignedData
type SignerData ¶
type SignerData struct { Version int `asn1:"default:1"` DigestAlgorithmIdentifiers []pkix.AlgorithmIdentifier `asn1:"set"` ContentInfo ContentInfo Certificates RawCertificates `asn1:"optional,tag:0"` CRLs []pkix.CertificateList `asn1:"optional,tag:1"` SignerInfos []SignerInfo `asn1:"set"` }
type SignerInfo ¶
type SignerInfo struct { Version int `asn1:"default:1"` IssuerAndSerialNumber IssuerAndSerial DigestAlgorithm pkix.AlgorithmIdentifier AuthenticatedAttributes []Attribute `asn1:"optional,omitempty,tag:0"` DigestEncryptionAlgorithm pkix.AlgorithmIdentifier EncryptedDigest []byte UnauthenticatedAttributes []Attribute `asn1:"optional,omitempty,tag:0"` // We don't use this }
type SigningContext ¶
type SigningContext struct { Cert *x509.Certificate Key *rsa.PrivateKey KeySigner crypto.Signer SigData []byte Indirect bool }
type SpcIndirectDataContentPe ¶
type SpcIndirectDataContentPe struct { Data struct { Type asn1.ObjectIdentifier Value struct { Flags asn1.BitString File struct { URL string `asn1:"optional,tag:0,ia5"` Moniker struct { ClassID []byte SerializedData []byte } `asn1:"optional,tag:1"` File struct { Unicode string `asn1:"optional,tag:0,utf8"` ASCII string `asn1:"optional,tag:1,ia5"` } `asn1:"optional,tag:2"` } `asn1:"tag:0"` } `asn1:"optional"` } MessageDigest struct { DigestAlgorithm pkix.AlgorithmIdentifier Digest []byte } }
Click to show internal directories.
Click to hide internal directories.