Documentation
¶
Overview ¶
Package tlock provides an API for encrypting/decrypting data using drand time lock encryption. This allows data to be encrypted and only decrypted in the future.
Index ¶
- Variables
- func BytesToCiphertext(scheme crypto.Scheme, b []byte) (*ibe.Ciphertext, error)
- func CiphertextToBytes(scheme crypto.Scheme, ciphertext *ibe.Ciphertext) ([]byte, error)
- func TimeLock(scheme crypto.Scheme, publicKey kyber.Point, roundNumber uint64, data []byte) (*ibe.Ciphertext, error)
- func TimeUnlock(scheme crypto.Scheme, publicKey kyber.Point, beacon chain.Beacon, ...) ([]byte, error)
- type Network
- type Tlock
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidPublicKey = errors.New("the public key received from the network to encrypt this was infinity and thus insecure")
var ErrTooEarly = errors.New("too early to decrypt")
ErrTooEarly represents an error when a decryption operation happens early.
var ErrWrongChainhash = errors.New("invalid chainhash")
Functions ¶
func BytesToCiphertext ¶
BytesToCiphertext converts bytes to a ciphertext.
func CiphertextToBytes ¶
CiphertextToBytes converts a ciphertext value to a set of bytes.
func TimeLock ¶
func TimeLock(scheme crypto.Scheme, publicKey kyber.Point, roundNumber uint64, data []byte) (*ibe.Ciphertext, error)
TimeLock encrypts the specified data for the given round number. The data can't be decrypted until the specified round is reached by the network in use.
func TimeUnlock ¶
func TimeUnlock(scheme crypto.Scheme, publicKey kyber.Point, beacon chain.Beacon, ciphertext *ibe.Ciphertext) ([]byte, error)
TimeUnlock decrypts the specified ciphertext for the given beacon. The ciphertext can't be decrypted until the specified round is reached by the network in use.
Types ¶
type Network ¶
type Network interface {
ChainHash() string
Current(time.Time) uint64
PublicKey() kyber.Point
Scheme() crypto.Scheme
Signature(roundNumber uint64) ([]byte, error)
SwitchChainHash(string) error
}
Network represents a system that provides support for encrypting/decrypting a DEK based on a future time.
type Tlock ¶
type Tlock struct {
// contains filtered or unexported fields
}
Tlock provides an API for time lock encryption and decryption.
func New ¶
New constructs a tlock for the specified network which can encrypt data that can be decrypted until the future. By default a new network will trust the chainhash it sees in ciphertexts and try and use these unless Strict was called to prevent it.
func (Tlock) Decrypt ¶
Decrypt will decrypt the source and write that to the destination. The decrypted data will not be decryptable unless the specified round from the encrypt call is reached by the network.
func (Tlock) Encrypt ¶
Encrypt will encrypt the source and write that to the destination. The encrypted data will not be decryptable until the specified round is reached by the network.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tle
command
|
|
|
tle/commands
Package commands implements the processing of the command line flags and processing of the encryption operation.
|
Package commands implements the processing of the command line flags and processing of the encryption operation. |
|
networks
|
|
|
http
Package http implements the Network interface for the tlock package.
|
Package http implements the Network interface for the tlock package. |