Documentation ¶
Overview ¶
Package signatures is used to check signatures. Only ED25519 which is not yet supported by crypto/x509 is implemented directly, other signatures are verified using x509 package.
Index ¶
- Constants
- Variables
- func Verify(signature *Signature) error
- type Signature
- func (*Signature) Descriptor() ([]byte, []int)
- func (s *Signature) Encode() ([]byte, error)
- func (m *Signature) GetMessage() []byte
- func (m *Signature) GetPublicKey() []byte
- func (m *Signature) GetSignature() []byte
- func (m *Signature) Marshal() (dAtA []byte, err error)
- func (m *Signature) MarshalTo(dAtA []byte) (int, error)
- func (*Signature) ProtoMessage()
- func (m *Signature) Reset()
- func (m *Signature) Size() (n int)
- func (m *Signature) String() string
- func (m *Signature) Unmarshal(dAtA []byte) error
- func (m *Signature) XXX_DiscardUnknown()
- func (m *Signature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Signature) XXX_Merge(src proto.Message)
- func (m *Signature) XXX_Size() int
- func (m *Signature) XXX_Unmarshal(b []byte) error
Constants ¶
const ( PureED25519 x509.SignatureAlgorithm = iota + 1000 // SignaturePEMLabel is the label of a PEM-encoded signed message SignaturePEMLabel = "MESSAGE" )
List of signature algorithms supported in addition to x509.
Variables ¶
var ( ErrInvalidLengthSignature = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowSignature = fmt.Errorf("proto: integer overflow") )
var ErrInvalidSignature = errors.New("signature verification failed")
ErrInvalidSignature is the error returned when the signature verification failed
var ErrNotImplemented = errors.New("Unhandled signature algorithm")
ErrNotImplemented is the error returned when trying to sign a message with an unimplemented algorithm.
Functions ¶
Types ¶
type Signature ¶
type Signature struct { PublicKey []byte `protobuf:"bytes,2,opt,name=publicKey,proto3" json:"public_key"` Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"` Message []byte `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Signature describes a signed message. It contains: - the digital signature algorithm used to sign the message - the publicKey of the signer - the original message - the signature. Depending on the algorithm, either the whole message or just a hash of it is signed.
func ParseSignature ¶
ParseSignature deserializes a signature from a PEM format.
func Sign ¶
Sign signs a message with the private key. It returns a Signature object containing the public key, the identifier for the signature algorithm used, the message that was signed and the signature. The secretKey argument must be the content of a PEM file containing the secret key.
func (*Signature) Descriptor ¶
func (*Signature) GetMessage ¶
func (*Signature) GetPublicKey ¶
func (*Signature) GetSignature ¶
func (*Signature) ProtoMessage ¶
func (*Signature) ProtoMessage()
func (*Signature) XXX_DiscardUnknown ¶
func (m *Signature) XXX_DiscardUnknown()