Documentation ¶
Index ¶
- func CheckUserRegisterCert(cert []byte, idhex string, fpr string, chainid uint64) error
- func CompressPubkey(pubkey *ecdsa.PublicKey) []byte
- func CreateAddress(b common.Address, nonce uint64) common.Address
- func DecompressPubkey(pubkey []byte) (*ecdsa.PublicKey, error)
- func DefaultDataDir() string
- func Ecrecover(hash, sig []byte) ([]byte, error)
- func FromECDSA(priv *ecdsa.PrivateKey) []byte
- func FromECDSAPub(pub *ecdsa.PublicKey) []byte
- func GenRCA(emailAddress string, isCA bool, caName string, privName string, pubName string) error
- func GenerateABKey(AX string, AY string, BX string, BY string, AprivKey *ecdsa.PrivateKey) (ret []string, s *ecdsa.PrivateKey, err error)
- func GenerateABPrivKey(A *ecdsa.PublicKey, B *ecdsa.PublicKey, AprivKey *ecdsa.PrivateKey) (A1 *ecdsa.PublicKey, S *ecdsa.PublicKey, s *ecdsa.PrivateKey, err error)
- func GenerateABPrivateKey(privateKey *ecdsa.PrivateKey, privateKey2 *ecdsa.PrivateKey, ...) (retPriv1 *ecdsa.PrivateKey, retPriv2 *ecdsa.PrivateKey, err error)
- func GenerateCreditPubKey(committeepubkey string, privkey *ecdsa.PrivateKey) *ecdsa.PublicKey
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func GenerateRSAKeypair() error
- func GenerteABPrivateKey(privateKey *ecdsa.PrivateKey, privateKey2 *ecdsa.PrivateKey, AX string, ...) (retPub *ecdsa.PublicKey, retPriv1 *ecdsa.PrivateKey, ...)
- func Hash(data []byte)
- func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)
- func Keccak256(data ...[]byte) []byte
- func Keccak256Hash(data ...[]byte) (h common.Hash)
- func Keccak512(data ...[]byte) []byte
- func LoadECDSA(file string) (*ecdsa.PrivateKey, error)
- func PubkeyToAddress(p ecdsa.PublicKey) common.Address
- func RSA_Sign(message string) (string, error)
- func RSA_Verify(message string, sig string) bool
- func RSA_Verify_Pub(message string, sig string, pub *rsa.PublicKey) bool
- func RSA_Verify_Standard(message string, sig string, pubKey interface{}) error
- func ReadUserCert() string
- func S256() elliptic.Curve
- func SaveCA(caName string, cert []byte) error
- func SaveECDSA(file string, key *ecdsa.PrivateKey) error
- func ScanA1(b []byte, A *ecdsa.PublicKey, S *ecdsa.PublicKey) ecdsa.PublicKey
- func ScanPubSharesA1(bA *ecdsa.PublicKey, S *ecdsa.PublicKey) ecdsa.PublicKey
- func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)
- func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error)
- func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)
- func ToECDSAPub(pub []byte) *ecdsa.PublicKey
- func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey
- func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool
- func VerifySignature(pubkey, hash, signature []byte) bool
- type Signer
- type Unsigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckUserRegisterCert ¶
func CompressPubkey ¶
CompressPubkey encodes a public key to the 33-byte compressed format.
func CreateAddress ¶
Creates an ethereum address given the bytes and the nonce
func DecompressPubkey ¶
DecompressPubkey parses a public key in the 33-byte compressed format.
func DefaultDataDir ¶
func DefaultDataDir() string
DefaultDataDir is the default data directory to use for the databases and other persistence requirements.
func FromECDSA ¶
func FromECDSA(priv *ecdsa.PrivateKey) []byte
FromECDSA exports a private key into a binary dump.
func FromECDSAPub ¶
func GenerateABKey ¶
func GenerateABKey(AX string, AY string, BX string, BY string, AprivKey *ecdsa.PrivateKey) (ret []string, s *ecdsa.PrivateKey, err error)
Generate account interface
func GenerateABPrivKey ¶
func GenerateABPrivKey(A *ecdsa.PublicKey, B *ecdsa.PublicKey, AprivKey *ecdsa.PrivateKey) (A1 *ecdsa.PublicKey, S *ecdsa.PublicKey, s *ecdsa.PrivateKey, err error)
GenerateABPrivKey generates an OTA account for receiver using receiver's publickey
func GenerateABPrivateKey ¶
func GenerateABPrivateKey(privateKey *ecdsa.PrivateKey, privateKey2 *ecdsa.PrivateKey, destPubA *ecdsa.PublicKey, destPubB *ecdsa.PublicKey) (retPriv1 *ecdsa.PrivateKey, retPriv2 *ecdsa.PrivateKey, err error)
GenerteABPrivateKey generates the privatekey for an AB account using receiver's main account's privatekey
func GenerateCreditPubKey ¶
func GenerateCreditPubKey(committeepubkey string, privkey *ecdsa.PrivateKey) *ecdsa.PublicKey
GenerateCreditPubKey returns credit info encrypt Public key
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
func GenerateRSAKeypair ¶
func GenerateRSAKeypair() error
GenerateRSAKeypair generate RSA format public key and private key
func GenerteABPrivateKey ¶
func GenerteABPrivateKey(privateKey *ecdsa.PrivateKey, privateKey2 *ecdsa.PrivateKey, AX string, AY string, BX string, BY string) (retPub *ecdsa.PublicKey, retPriv1 *ecdsa.PrivateKey, retPriv2 *ecdsa.PrivateKey, err error)
GenerteABPrivateKey generates the privatekey for an AB account using receiver's main account's privatekey
func HexToECDSA ¶
func HexToECDSA(hexkey string) (*ecdsa.PrivateKey, error)
HexToECDSA parses a secp256k1 private key.
func Keccak256Hash ¶
Keccak256Hash calculates and returns the Keccak256 hash of the input data, converting it to an internal Hash data structure.
func LoadECDSA ¶
func LoadECDSA(file string) (*ecdsa.PrivateKey, error)
LoadECDSA loads a secp256k1 private key from the given file.
func RSA_Verify_Standard ¶
func SaveECDSA ¶
func SaveECDSA(file string, key *ecdsa.PrivateKey) error
SaveECDSA saves a secp256k1 private key to the given file with restrictive permissions. The key data is saved hex-encoded.
func ScanPubSharesA1 ¶
A1=[hash([b]A)]G+S
func Sign ¶
func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error)
Sign calculates an ECDSA signature.
This function is susceptible to chosen plaintext attacks that can leak information about the private key that is used for signing. Callers must be aware that the given hash cannot be chosen by an adversery. Common solution is to hash any input before calculating the signature.
The produced signature is in the [R || S || V] format where V is 0 or 1.
func ToECDSA ¶
func ToECDSA(d []byte) (*ecdsa.PrivateKey, error)
ToECDSA creates a private key with the given D value.
func ToECDSAPub ¶
func ToECDSAUnsafe ¶
func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey
ToECDSAUnsafe blindly converts a binary blob to a private key. It should almost never be used unless you are sure the input is valid and want to avoid hitting errors due to bad origin encoding (0 prefixes cut off).
func 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 VerifySignature ¶
VerifySignature checks that the given public key created signature over hash. The public key should be in compressed (33 bytes) or uncompressed (65 bytes) format. The signature should have the 64 byte [R || S] format.
Types ¶
type Signer ¶
type Signer interface { // Sign returns raw signature for the given data. This method // will apply the hash specified for the keytype to the data. Sign(data []byte) ([]byte, error) }
A Signer is can create signatures that verify against a public key.
type Unsigner ¶
type Unsigner interface { // Sign returns raw signature for the given data. This method // will apply the hash specified for the keytype to the data. Unsign(data []byte) ([]byte, error) VerifySign(message []byte, sig []byte) error }
A Signer is can create signatures that verify against a public key.
Directories ¶
Path | Synopsis |
---|---|
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve.
|
Package bn256 implements the Optimal Ate pairing over a 256-bit Barreto-Naehrig curve. |
cloudflare
Package bn256 implements a particular bilinear group at the 128-bit security level.
|
Package bn256 implements a particular bilinear group at the 128-bit security level. |
google
Package bn256 implements a particular bilinear group at the 128-bit security level.
|
Package bn256 implements a particular bilinear group at the 128-bit security level. |
Package secp256k1 wraps the bitcoin secp256k1 C library.
|
Package secp256k1 wraps the bitcoin secp256k1 C library. |
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
|
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202. |