Documentation ¶
Index ¶
- Variables
- func CBCDecrypt(key, iv, cipherText []byte) ([]byte, error)
- func CBCEncrypt(key, iv, plainText []byte) ([]byte, error)
- func CheckKey(p *PublicKey) bool
- func CheckScalar(p *PrivateKey) bool
- func Decrypt(p *PrivateKey, encryptedText []byte) ([]byte, error)
- func Encrypt(p *PublicKey, plainText []byte) ([]byte, error)
- func PrivateKeyToPem(priv *PrivateKey) ([]byte, error)
- func PublicKeyToPem(pub *PublicKey) ([]byte, error)
- func SetupKeyFactory(f KeyFactory)
- func Sign(random io.Reader, p *PrivateKey, message []byte) ([64]byte, error)
- func Sm3Sum(bts []byte) [32]byte
- func Verify(p *PublicKey, message []byte, sig [64]byte) bool
- type KeyFactory
- type PrivateKey
- func AddPrivate(p, p1 *PrivateKey) (*PrivateKey, error)
- func DeterministicHashDerive(p *PublicKey) *PrivateKey
- func NewPrivateKey(rand io.Reader) *PrivateKey
- func PrivateKeyFromBytes(key *[33]byte) (*PrivateKey, error)
- func PrivateKeyFromInteger(d *big.Int) (*PrivateKey, error)
- func PrivateKeyFromPem(pemBts []byte) (*PrivateKey, error)
- func ScalarHash(p *PublicKey, outputIndex uint64) *PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
View Source
var (
N, P, B *big.Int
Gnx, Gny *big.Int
)
Functions ¶
func CBCDecrypt ¶
func CBCEncrypt ¶
func CheckScalar ¶ added in v0.1.1
func CheckScalar(p *PrivateKey) bool
func PrivateKeyToPem ¶ added in v0.1.0
func PrivateKeyToPem(priv *PrivateKey) ([]byte, error)
func PublicKeyToPem ¶ added in v0.1.0
func SetupKeyFactory ¶
func SetupKeyFactory(f KeyFactory)
Types ¶
type KeyFactory ¶
type KeyFactory interface { // sm2 Sm2Sign(random io.Reader, p *PrivateKey, message []byte) (signature [64]byte, err error) Sm2Verify(pub *PublicKey, message []byte, signature [64]byte) bool Sm2Encrypt(random io.Reader, pub *PublicKey, msg []byte) ([]byte, error) Sm2Decrypt(p *PrivateKey, encryptedText []byte) (plainText []byte, err error) // sm3 Sm3Sum(message []byte) (digest [32]byte) // sm4 Sm4CBCEncrypt(key, iv, plainText []byte) ([]byte, error) Sm4CBCDecrypt(key, iv, cipherText []byte) ([]byte, error) }
type PrivateKey ¶
func AddPrivate ¶ added in v0.1.1
func AddPrivate(p, p1 *PrivateKey) (*PrivateKey, error)
func DeterministicHashDerive ¶ added in v0.1.2
func DeterministicHashDerive(p *PublicKey) *PrivateKey
func NewPrivateKey ¶ added in v0.0.3
func NewPrivateKey(rand io.Reader) *PrivateKey
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(key *[33]byte) (*PrivateKey, error)
func PrivateKeyFromInteger ¶ added in v0.0.8
func PrivateKeyFromInteger(d *big.Int) (*PrivateKey, error)
func PrivateKeyFromPem ¶ added in v0.1.0
func PrivateKeyFromPem(pemBts []byte) (*PrivateKey, error)
func ScalarHash ¶ added in v0.1.1
func ScalarHash(p *PublicKey, outputIndex uint64) *PrivateKey
func (*PrivateKey) Bytes ¶
func (p *PrivateKey) Bytes() [33]byte
func (*PrivateKey) PublicKey ¶
func (p *PrivateKey) PublicKey() *PublicKey
func (*PrivateKey) String ¶
func (p *PrivateKey) String() string
type PublicKey ¶
func PublicKeyFromBytes ¶
func PublicKeyFromPem ¶ added in v0.1.0
func ScalarMult ¶ added in v0.1.1
func ScalarMult(p *PrivateKey, pub *PublicKey) (*PublicKey, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.