Documentation ¶
Index ¶
- Constants
- func ComputeSharedSecret(prv *Prv, pub *Pub) sha256.Hash
- func GenNonces(count int) (n []nonce.IV)
- func GenPingNonces() (n [6]nonce.IV)
- func GenerateTestKeyPair() (sp *Prv, sP *Pub, e error)
- func GenerateTestKeyPairs() (sp, rp *Prv, sP, rP *Pub, e error)
- func GetCipherSet() (prvs Privs, pubs Pubs)
- func Match(r CloakedPubKey, k PubBytes) bool
- func NewSigner() (first *Prv, ks *KeySet, e error)
- type Blinder
- type Ciphers
- type CloakedPubKey
- type Hash
- type KeySet
- type Keys
- type Nonces
- type Privs
- type Prv
- func (p *Prv) Equals(key crypto.Key) (eq bool)
- func (p *Prv) GetPublic() crypto.PubKey
- func (p *Prv) Raw() ([]byte, error)
- func (p *Prv) Sign(bytes []byte) ([]byte, error)
- func (p *Prv) ToBased32() (s string)
- func (p *Prv) ToBytes() (b PrvBytes)
- func (p *Prv) Type() crypto_pb.KeyType
- func (p *Prv) Zero()
- type PrvBytes
- type Pub
- func (k *Pub) Equals(key crypto.Key) (eq bool)
- func (k *Pub) Raw() ([]byte, error)
- func (k *Pub) String() (s string)
- func (k *Pub) ToBased32() (s string)
- func (k *Pub) ToBased32Abbreviated() (s string)
- func (k *Pub) ToBytes() (p PubBytes)
- func (k *Pub) ToHex() (s string, e error)
- func (k *Pub) ToPublicKey() *secp256k1.PublicKey
- func (k *Pub) Type() crypto_pb.KeyType
- func (k *Pub) Verify(data []byte, sigBytes []byte) (is bool, e error)
- type PubBytes
- type Pubs
- type SigBytes
Constants ¶
const ( // BlindLen is the length of the blinding factor in bytes for a Cloak. BlindLen = 3 // HashLen is the length from the hash of the key with the Blinder appended to // the Cloak. HashLen = 5 // CloakLen is the sum of the Blinder truncated hash from blinder and public key. CloakLen = BlindLen + HashLen // PrvKeyLen is the length of a private key, inherited from secp256k1. PrvKeyLen = secp256k1.PrivKeyBytesLen // PubKeyLen is the length of the serialized key. It is an ECDSA compressed // key, 33 bytes with a 2 or 3 prefix to signify the sign of the key. PubKeyLen = secp256k1.PubKeyBytesLenCompressed // SigLen is the length of the signatures used in Indra, compact keys that can // have the public key extracted from them. SigLen = 65 )
Variables ¶
This section is empty.
Functions ¶
func ComputeSharedSecret ¶
ComputeSharedSecret computes an Elliptic Curve Diffie-Hellman shared secret that can be decrypted by the holder of the private key matching the public key provided.
func GenPingNonces ¶
GenPingNonces generates 6 Initialization Vector bytes.
func GenerateTestKeyPair ¶
GenerateTestKeyPair generates a key pair.
func GenerateTestKeyPairs ¶
GenerateTestKeyPairs generates two public/private key pairs.
func GetCipherSet ¶
GetCipherSet generates a set of Privs and Pubs.
func Match ¶
func Match(r CloakedPubKey, k PubBytes) bool
Match uses the cached public key and the provided blinding factor to match the source public key so the packet address field is only recognisable to the intended recipient.
Types ¶
type Ciphers ¶
Ciphers is a collection of 3 encyrption keys used progressively for a reply message payload.
func GenCiphers ¶
GenCiphers generates a set of 3 Ciphers using Privs and Pubs.
type CloakedPubKey ¶
CloakedPubKey is the blinded hash of a public key used to conceal a message public key from attackers.
func Cloak ¶
func Cloak(b Blinder, key PubBytes) (c CloakedPubKey)
func GetCloak ¶
func GetCloak(s *Pub) (c CloakedPubKey)
GetCloak returns a value which a receiver with the private key can identify the association of a message with the peer in order to retrieve the private key to generate the message cipher.
The three byte blinding factor concatenated in front of the public key generates the 5 bytes at the end of the CloakedPubKey code. In this way the source public key it relates to is hidden to any who don't have this public key, which only the parties know.
type KeySet ¶
KeySet is a fast private key generator that uses two random base private keys and combines one with the other repeatedly to generate a new, valid private key, using scalar multiplication.
func (*KeySet) Next ¶
Next adds Increment to Base, assigns the new private key to the Base and returns the new private key.
type Keys ¶
Keys is a structure for a pre-formed public/private key set with the public key bytes ready for fast comparisons.
func Generate2Keys ¶
Generate2Keys generates two Keys.
type Privs ¶
type Privs [3]*Prv
Privs is a collection of 3 private keys used for generating reply headers.
type Prv ¶
type Prv secp256k1.PrivateKey
Prv is a secp256k1 private key.
func GeneratePrvKey ¶
GeneratePrvKey generates a secp256k1 private key.
func GetTwoPrvKeys ¶
func GetTwoPrvKeys() (prv1, prv2 *Prv)
GetTwoPrvKeys is a helper for tests to generate two new private keys.
func PrvFromBased32 ¶
PrvFromBased32 decodes a Based32 encoded private key.
func PrvKeyFromBytes ¶
PrvKeyFromBytes converts a byte slice into a private key.
func (*Prv) Equals ¶
Equals is an implementation of the libp2p crypto.Key interface, allowing the Indra keys to be used by libp2p as peer identity keys.
func (*Prv) GetPublic ¶
GetPublic derives the public key matching a private key, an implementation of the libp2p crypto.PrivKey interface, allowing the Indra keys to be used by libp2p as peer identity keys.
func (*Prv) Raw ¶
Raw is an implementation of the libp2p crypto.Key interface, allowing the Indra keys to be used by libp2p as peer identity keys.
func (*Prv) Sign ¶
Sign is an implementation of the libp2p crypto.PrivKey interface, allowing the Indra keys to be used by libp2p as peer identity keys.
type Pub ¶
type Pub secp256k1.PublicKey
Pub is a public key.
func PubFromBased32 ¶
PubFromBased32 decodes a Based32 encoded form of the Pub.
func PubFromBytes ¶
PubFromBytes converts a byte slice into a public key, if it is valid and on the secp256k1 elliptic curve.
func (*Pub) Raw ¶
Raw is an implementation of the libp2p crypto.Key interface, allowing the Indra keys to be used by libp2p as peer identity keys.
func (*Pub) ToBased32Abbreviated ¶
func (*Pub) ToBytes ¶
ToBytes returns the compressed 33 byte form of the pubkey as used in wire and storage forms.
func (*Pub) ToPublicKey ¶
func (k *Pub) ToPublicKey() *secp256k1.PublicKey
ToPublicKey unwraps the secp256k1.PublicKey inside the Pub.
type PubBytes ¶
PubBytes is the serialised form of a secp256k1 public key.
type Pubs ¶
type Pubs [3]*Pub
Pubs is a collection of 3 public keys used for generating reply headers.
type SigBytes ¶
SigBytes is an ECDSA BIP62 formatted compact signature which allows the recovery of the public key from the signature.
func SigFromBased32 ¶
SigFromBased32 decodes a SigBytes encoded in Based32.
Directories ¶
Path | Synopsis |
---|---|
Package ciph manages encryption ciphers and encrypting blobs of data.
|
Package ciph manages encryption ciphers and encrypting blobs of data. |
Package nonce provides a simple interface for generating standard AES encryption nonces that give strong cryptographic entropy to message encryption.
|
Package nonce provides a simple interface for generating standard AES encryption nonces that give strong cryptographic entropy to message encryption. |
Package sha256 provides a simple interface for single and double SHA256 hashes, used with secp256k1 signatures, message digest checksums, cloaked public key "addresses" and so on.
|
Package sha256 provides a simple interface for single and double SHA256 hashes, used with secp256k1 signatures, message digest checksums, cloaked public key "addresses" and so on. |