crypto

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519                    = "ed25519"
	Curve25519xSalsa20Poly1305 = "curve25519xsalsa20poly1305"
	InvalidKeySize             = "Invalid key size"
	UnsupportedSignAlgo        = "Unsupported signing algorithm"
	InvalidSignature           = "Invalid signature"
)
View Source
const (
	// HashTreeTTL is the TTL of one hash tree (in seconds).
	// FIXME(shitz): This should really be matching spath.MaxTTL, but more importantly,
	// it needs to match the hash tree ttl used by the BS, which is currently set to 30 mins.
	HashTreeTTL = 30 * 60 * time.Second

	// HashTreeEpochTime is the duration of one epoch (in seconds).
	HashTreeEpochTime = 10 * time.Second

	// HashTreeEpochTolerance is the duration after a revocation expired within which a
	// revocation is still accepted by a verifier.
	HashTreeEpochTolerance = 2 * time.Second
)

Variables

This section is empty.

Functions

func GetCurrentHashTreeEpoch

func GetCurrentHashTreeEpoch() uint64

GetCurrentHashTreeEpoch returns the current epoch ID.

func GetTimeSinceHashTreeEpoch

func GetTimeSinceHashTreeEpoch(epoch uint64) time.Duration

GetTimeSinceHashTreeEpoch returns the time since the start of epoch.

func Sign

func Sign(sigInput, signKey common.RawBytes, signAlgo string) (common.RawBytes, error)

Sign takes a signature input and a signing key to create a signature. Currently only ed25519 is supported

func Verify

func Verify(sigInput, sig, verifyKey common.RawBytes, signAlgo string) error

Verify takes a signature input and a verifying key and returns an error, if the signature does not match. Currently only ed25519 is supported.

func VerifyHashTreeEpoch

func VerifyHashTreeEpoch(epoch uint64) bool

VerifyHashTreeEpoch verifies a given hash tree epoch. An epoch is valid if it is equal to the current epoch or within the tolerance limit of the next epoch.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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