Source File
one_pass_signature.go
Belonging Package
golang.org/x/crypto/openpgp/packet
package packet
import (
)
type OnePassSignature struct {
SigType SignatureType
Hash crypto.Hash
PubKeyAlgo PublicKeyAlgorithm
KeyId uint64
IsLast bool
}
const onePassSignatureVersion = 3
func ( *OnePassSignature) ( io.Reader) ( error) {
var [13]byte
_, = readFull(, [:])
if != nil {
return
}
if [0] != onePassSignatureVersion {
= errors.UnsupportedError("one-pass-signature packet version " + strconv.Itoa(int([0])))
}
var bool
.Hash, = s2k.HashIdToHash([2])
if ! {
return errors.UnsupportedError("hash function: " + strconv.Itoa(int([2])))
}
.SigType = SignatureType([1])
.PubKeyAlgo = PublicKeyAlgorithm([3])
.KeyId = binary.BigEndian.Uint64([4:12])
.IsLast = [12] != 0
return
}
func ( *OnePassSignature) ( io.Writer) error {
var [13]byte
[0] = onePassSignatureVersion
[1] = uint8(.SigType)
var bool
[2], = s2k.HashToHashId(.Hash)
if ! {
return errors.UnsupportedError("hash type: " + strconv.Itoa(int(.Hash)))
}
[3] = uint8(.PubKeyAlgo)
binary.BigEndian.PutUint64([4:12], .KeyId)
if .IsLast {
[12] = 1
}
if := serializeHeader(, packetTypeOnePassSignature, len()); != nil {
return
}
, := .Write([:])
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |