Documentation
¶
Index ¶
- Constants
- Variables
- func CRandBytes(numBytes int) []byte
- func CRandHex(numDigits int) string
- func CReader() io.Reader
- func GenerateKeyPair() (PublicKey, PrivateKey, error)
- func QuantumResistantSign(privateKey PrivateKey, message []byte) ([]byte, error)
- func SaveKeyPairToFile(filename string, keypair KeyPair, password []byte) error
- func SaveKeyPairToGCPKMS(ctx context.Context, filename string, keypair KeyPair, kmsKeyResource string, ...) error
- func Sha256(bytes []byte) []byte
- func VerifyQuantumSig(publicKey PublicKey, message []byte, signature []byte) bool
- type Address
- type DilithiumPubKey
- type KeyPair
- type PrivKey
- type PrivateKey
- type PubKey
- type PublicKey
- type Symmetric
Examples ¶
Constants ¶
const ( // AddressSize is the size of a pubkey address. AddressSize = tmhash.TruncatedSize )
const Version = "0.9.0-dev"
Variables ¶
Functions ¶
func CRandHex ¶
CRandHex returns a hex encoded string that's floor(numDigits/2) * 2 long.
Note: CRandHex(24) gives 96 bits of randomness that are usually strong enough for most purposes.
func GenerateKeyPair ¶
func GenerateKeyPair() (PublicKey, PrivateKey, error)
GenerateKeyPair generates a Kyber768 key pair (NIST PQC Standardized)
func QuantumResistantSign ¶
func QuantumResistantSign(privateKey PrivateKey, message []byte) ([]byte, error)
QuantumResistantSign signs a message using Dilithium Mode 3
func SaveKeyPairToFile ¶
Encrypts and saves the keypair to a file
func SaveKeyPairToGCPKMS ¶
func SaveKeyPairToGCPKMS(ctx context.Context, filename string, keypair KeyPair, kmsKeyResource string, credsFile string) error
SaveKeyPairToGCPKMS encrypts and saves the keypair using GCP KMS
Types ¶
type Address ¶
An address is a []byte, but hex-encoded even in JSON. []byte leaves us the option to change the address length. Use an alias so Unmarshal methods (with ptr receivers) are available too.
func AddressHash ¶
type DilithiumPubKey ¶
type DilithiumPubKey struct {
Key []byte
}
DilithiumPubKey represents a quantum-resistant public key for consensus.
func (DilithiumPubKey) VerifySignature ¶
func (pk DilithiumPubKey) VerifySignature(msg []byte, sig []byte) bool
VerifySignature verifies a Dilithium signature for the given message.
type KeyPair ¶
KeyPair holds both public and private keys
func LoadKeyPairFromFile ¶
Loads and decrypts the keypair from a file
type PrivateKey ¶
type PrivateKey = []byte
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
Package merkle computes a deterministic minimal height Merkle tree hash.
|
Package merkle computes a deterministic minimal height Merkle tree hash. |
|
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha.
|
Package xchacha20poly1305 creates an AEAD using hchacha, chacha, and poly1305 This allows for randomized nonces to be used in conjunction with chacha. |