Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKey() (publicKey []byte, secretKey []byte, err error)
- func PrivateAndPublicFromPrivateKey(compositePrivateKey []byte) (privateBytes []byte, publicBytes []byte, err error)
- func Sign(secretKey []byte, message []byte) ([]byte, error)
- func Verify(message []byte, signature []byte, publicKey []byte) error
- type HybridSig
- func (s HybridSig) CombinePublicKeySignature(sigBytes []byte, pubKeyBytes []byte) (combinedSignature []byte, err error)
- func (s HybridSig) DecodePublicKey(encoded []byte) (*signaturealgorithm.PublicKey, error)
- func (s HybridSig) DeserializePrivateKey(priv []byte) (*signaturealgorithm.PrivateKey, error)
- func (s HybridSig) DeserializePublicKey(pub []byte) (*signaturealgorithm.PublicKey, error)
- func (s HybridSig) EncodePublicKey(pubKey *signaturealgorithm.PublicKey) []byte
- func (s HybridSig) GenerateKey() (*signaturealgorithm.PrivateKey, error)
- func (s HybridSig) HexToPrivateKey(hexkey string) (*signaturealgorithm.PrivateKey, error)
- func (s HybridSig) HexToPrivateKeyNoError(hexkey string) *signaturealgorithm.PrivateKey
- func (s HybridSig) HexToPublicKey(hexkey string) (*signaturealgorithm.PublicKey, error)
- func (s HybridSig) LoadPrivateKeyFromFile(file string) (*signaturealgorithm.PrivateKey, error)
- func (s HybridSig) PrivateKeyLength() int
- func (s HybridSig) PrivateKeyToHex(priv *signaturealgorithm.PrivateKey) (string, error)
- func (s HybridSig) PublicKeyAndSignatureFromCombinedSignature(digestHash []byte, sig []byte) (signature []byte, pubKey []byte, err error)
- func (s HybridSig) PublicKeyBytesFromSignature(digestHash []byte, sig []byte) ([]byte, error)
- func (s HybridSig) PublicKeyFromSignature(digestHash []byte, sig []byte) (*signaturealgorithm.PublicKey, error)
- func (s HybridSig) PublicKeyLength() int
- func (s HybridSig) PublicKeyStartValue() byte
- func (s HybridSig) PublicKeyToAddress(p *signaturealgorithm.PublicKey) (common.Address, error)
- func (s HybridSig) PublicKeyToAddressNoError(p *signaturealgorithm.PublicKey) common.Address
- func (s HybridSig) PublicKeyToHex(pub *signaturealgorithm.PublicKey) (string, error)
- func (s HybridSig) SavePrivateKeyToFile(file string, key *signaturealgorithm.PrivateKey) error
- func (s HybridSig) SerializePrivateKey(priv *signaturealgorithm.PrivateKey) ([]byte, error)
- func (s HybridSig) SerializePublicKey(pub *signaturealgorithm.PublicKey) ([]byte, error)
- func (s HybridSig) Sign(digestHash []byte, prv *signaturealgorithm.PrivateKey) (sig []byte, err error)
- func (s HybridSig) SignatureLength() int
- func (s HybridSig) SignatureName() string
- func (s HybridSig) SignatureStartValue() byte
- func (s HybridSig) SignatureWithPublicKeyLength() int
- func (osig HybridSig) ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool
- func (s HybridSig) Verify(pubKey []byte, digestHash []byte, signature []byte) bool
- func (s HybridSig) Zeroize(prv *signaturealgorithm.PrivateKey)
Constants ¶
View Source
const ( OK = 0 CRYPTO_SECRETKEY_BYTES = 64 + 1281 + 897 CRYPTO_PUBLICKEY_BYTES = 32 + 897 CRYPTO_SIGNATURE_BYTES = 2 + 2 + 64 + CRYPTO_MESSAGE_LEN + 40 + 690 //Nonce + 2 for size CRYPTO_MESSAGE_LEN = 32 //todo: validate this SIG_NAME = "Falcon-512-ed25519" )
Variables ¶
View Source
var ( ErrSignatureInitial = errors.New("signature mechanism is not supported by OQS") ErrInvalidMsgLen = errors.New("invalid message length, need max 64 bytes") ErrInvalidSignatureLen = errors.New("invalid signature length") ErrInvalidPublicKeyLen = errors.New("invalid public key length") ErrInvalidPrivateKeyLen = errors.New("invalid private key length") ErrInvalidRecoveryID = errors.New("invalid signature recovery id") ErrInvalidKey = errors.New("invalid private key") ErrInvalidPubkey = errors.New("invalid public key") ErrMismatchPublicKey = errors.New("mismatch public key") ErrSignFailed = errors.New("signing failed") ErrRecoverFailed = errors.New("recovery failed") ErrKeypairFailed = errors.New("can not generate keypair") ErrInvalidLen = errors.New("invalid length") ErrVerifyFailed = errors.New("verify length") ErrRecoverPublicKeyFailed = errors.New("recover public key length") )
Functions ¶
func GenerateKey ¶
Types ¶
type HybridSig ¶
type HybridSig struct {
// contains filtered or unexported fields
}
func CreateHybridSig ¶
func CreateHybridSig() HybridSig
func (HybridSig) CombinePublicKeySignature ¶
func (HybridSig) DecodePublicKey ¶
func (s HybridSig) DecodePublicKey(encoded []byte) (*signaturealgorithm.PublicKey, error)
func (HybridSig) DeserializePrivateKey ¶
func (s HybridSig) DeserializePrivateKey(priv []byte) (*signaturealgorithm.PrivateKey, error)
func (HybridSig) DeserializePublicKey ¶
func (s HybridSig) DeserializePublicKey(pub []byte) (*signaturealgorithm.PublicKey, error)
func (HybridSig) EncodePublicKey ¶
func (s HybridSig) EncodePublicKey(pubKey *signaturealgorithm.PublicKey) []byte
func (HybridSig) GenerateKey ¶
func (s HybridSig) GenerateKey() (*signaturealgorithm.PrivateKey, error)
func (HybridSig) HexToPrivateKey ¶
func (s HybridSig) HexToPrivateKey(hexkey string) (*signaturealgorithm.PrivateKey, error)
func (HybridSig) HexToPrivateKeyNoError ¶
func (s HybridSig) HexToPrivateKeyNoError(hexkey string) *signaturealgorithm.PrivateKey
func (HybridSig) HexToPublicKey ¶
func (s HybridSig) HexToPublicKey(hexkey string) (*signaturealgorithm.PublicKey, error)
func (HybridSig) LoadPrivateKeyFromFile ¶
func (s HybridSig) LoadPrivateKeyFromFile(file string) (*signaturealgorithm.PrivateKey, error)
func (HybridSig) PrivateKeyLength ¶
func (HybridSig) PrivateKeyToHex ¶
func (s HybridSig) PrivateKeyToHex(priv *signaturealgorithm.PrivateKey) (string, error)
func (HybridSig) PublicKeyAndSignatureFromCombinedSignature ¶
func (HybridSig) PublicKeyBytesFromSignature ¶
func (HybridSig) PublicKeyFromSignature ¶
func (HybridSig) PublicKeyLength ¶
func (HybridSig) PublicKeyStartValue ¶
func (HybridSig) PublicKeyToAddress ¶
func (HybridSig) PublicKeyToAddressNoError ¶
func (s HybridSig) PublicKeyToAddressNoError(p *signaturealgorithm.PublicKey) common.Address
func (HybridSig) PublicKeyToHex ¶
func (s HybridSig) PublicKeyToHex(pub *signaturealgorithm.PublicKey) (string, error)
func (HybridSig) SavePrivateKeyToFile ¶
func (s HybridSig) SavePrivateKeyToFile(file string, key *signaturealgorithm.PrivateKey) error
func (HybridSig) SerializePrivateKey ¶
func (s HybridSig) SerializePrivateKey(priv *signaturealgorithm.PrivateKey) ([]byte, error)
func (HybridSig) SerializePublicKey ¶
func (s HybridSig) SerializePublicKey(pub *signaturealgorithm.PublicKey) ([]byte, error)
func (HybridSig) Sign ¶
func (s HybridSig) Sign(digestHash []byte, prv *signaturealgorithm.PrivateKey) (sig []byte, err error)
func (HybridSig) SignatureLength ¶
func (HybridSig) SignatureName ¶
func (HybridSig) SignatureStartValue ¶
func (HybridSig) SignatureWithPublicKeyLength ¶
func (HybridSig) ValidateSignatureValues ¶
ValidateSignatureValues verifies whether the signature values are valid with the given chain rules. The v value is assumed to be either 0 or 1.
func (HybridSig) Zeroize ¶
func (s HybridSig) Zeroize(prv *signaturealgorithm.PrivateKey)
Click to show internal directories.
Click to hide internal directories.