siglib

package
v0.0.0-...-682d07f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMessageSignatures

func CheckMessageSignatures(msg *message.Message, publicKey keys.PublicKey) bool

CheckMessageSignatures verifies all signatures on the message. Signatures that are not valid now are removed. Returns true if at least one signature is valid and all signatures are correct.

Process is defined as:

  1. check that there is at least one signature
  2. check that string fields do not contain <whitespace>:<non whitespace>:<whitespace>
  3. sort message
  4. encode message
  5. sign the encoding and compare the resulting signature data with the signature data received with the message. The encoding of the signature meta data is added in the verifySignature() method

func CheckSectionSignatures

func CheckSectionSignatures(s section.WithSig, pkeys map[keys.PublicKeyID][]keys.PublicKey,
	maxVal util.MaxCacheValidity) bool

CheckSectionSignatures verifies all signatures on the section. Expired signatures are removed. Returns true if all signatures are correct. The content of a shard or zone must be sorted. If it is not, then the signature verification will fail.

Process is defined as:

  1. check that there is at least one signature
  2. check that string fields do not contain <whitespace>:<non whitespace>:<whitespace>
  3. encode section
  4. sign the encoding and compare the resulting signature data with the signature data received with the section. The encoding of the signature meta data is added in the verifySignature() method

func CheckSignatureNotExpired

func CheckSignatureNotExpired(s section.WithSig) bool

CheckSignatureNotExpired returns true if s is nil or all the signatures ValidUntil are in the future

func CheckStringFields

func CheckStringFields(s section.Section) bool

CheckStringFields returns true if non of the string fields of the given section contain a zone file type marker. It panics if the interface s contains a type but the interfaces value is nil

func SignMessage

func SignMessage(msg *message.Message, privateKey interface{}, sig signature.Sig) bool

SignMessage signs a message with the given private Key and adds the resulting bytestring to the given signature. Signatures with validUntil in the past are not signed and added Returns false if the signature was not added to the message

Process is defined as:

  1. check that the signature's ValidUntil is in the future
  2. check that string fields do not contain <whitespace>:<non whitespace>:<whitespace>
  3. sort message
  4. encode message
  5. sign the encoding and add it to the signature which will then be added to the message. The encoding of the signature meta data is added in the verifySignature() method

func SignMessageUnsafe

func SignMessageUnsafe(msg *message.Message, privateKey interface{}, sig signature.Sig) bool

SignMessageUnsafe signs a message with the given private Key and adds the resulting bytestring to the given signature. The messages content must already be sorted. It does not check the validity of the signature or the message. Returns false if the signature was not added to the message. FIXME: Note that this function only works if one signature is added. Otherwise the cbor marshaller also adds the previous signature to encoding which leads to a different signature.

func SignSection

func SignSection(s section.WithSig, privateKey interface{}, sig signature.Sig) bool

SignSection signs a section with the given private Key and adds the resulting bytestring to the given signature. Signatures with validUntil in the past are not signed and added Returns false if the signature was not added to the section

Process is defined as:

  1. check that the signature's ValidUntil is in the future
  2. check that string fields do not contain <whitespace>:<non whitespace>:<whitespace>
  3. sort section
  4. encode section
  5. sign the encoding and add it to the signature which will then be added to the section. The encoding of the signature meta data is added in the verifySignature() method

func SignSectionUnsafe

func SignSectionUnsafe(s section.WithSig, privateKey interface{}, sig signature.Sig) bool

SignSectionUnsafe signs a section with the given private Key and adds the resulting bytestring to the given signatures. The shard's or zone's content must already be sorted. It does not check the validity of the signature or the section. Returns false if the signature was not added to the section. FIXME: Note that this function only works if one signature is added. Otherwise the cbor marshaller also adds the previous signature to encoding which leads to a different signature.

func ValidSectionAndSignature

func ValidSectionAndSignature(s section.WithSig) bool

ValidSectionAndSignature returns true if the section is not nil, all the signatures ValidUntil are in the future, the string fields do not contain <whitespace>:<non whitespace>:<whitespace>, and the section's content is sorted (by sorting it).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL