Documentation ¶
Index ¶
- Constants
- Variables
- type Ecc
- func (e *Ecc) Decrypt(cipherText []byte) ([]byte, error)
- func (e *Ecc) Encrypt(plainText []byte) ([]byte, error)
- func (e *Ecc) GenerateEcdsaKey(keySize ...int)
- func (e *Ecc) LoadPem(privatePemFile, publicPemFile string) error
- func (e *Ecc) PrivateKeySignature(data []byte) (r, s []byte)
- func (e *Ecc) PublicKeyVerify(data, r, s []byte) bool
- func (e *Ecc) SavePem(pems ...string)
- type RsaCrypto
- func (grsa *RsaCrypto) EqualPrivateKeyString(pri string) bool
- func (grsa *RsaCrypto) EqualPublicKeyString(pub string) bool
- func (grsa *RsaCrypto) GetPrivateKey() string
- func (grsa *RsaCrypto) GetPublicKey() string
- func (grsa *RsaCrypto) InitByGenerateKey()
- func (grsa *RsaCrypto) PrivateKeyDecrypt(data string) (string, error)
- func (grsa *RsaCrypto) PrivateKeyDecryptByte(input []byte) ([]byte, error)
- func (grsa *RsaCrypto) PrivateKeyEncrypt(data string) (string, error)
- func (grsa *RsaCrypto) PrivateKeyEncryptByte(input []byte) ([]byte, error)
- func (grsa *RsaCrypto) PublicKeyDecrypt(data string) (string, error)
- func (grsa *RsaCrypto) PublicKeyDecryptByte(input []byte) ([]byte, error)
- func (grsa *RsaCrypto) PublicKeyEncrypt(data string) (string, error)
- func (grsa *RsaCrypto) PublicKeyEncryptByte(input []byte) ([]byte, error)
- func (grsa *RsaCrypto) SetPrivateKey(pri string) (err error)
- func (grsa *RsaCrypto) SetPublicKey(pub string) (err error)
Constants ¶
View Source
const ( PrivatePemType = "ecc private key" PrivatePemFile = "ecc.pri.pem" PublicPemType = "ecc public key" PublicPemFile = "ecc.pub.pem" )
ECC,全称椭圆曲线密码学(英语:Elliptic curve cryptography,缩写为 ECC),主要是指相关数学原理
View Source
const (
//GenericRSA_Bits 密钥长度
GenericRSA_Bits = 1024
)
Variables ¶
View Source
var ( ErrDataToLarge = errors.New("message too long for RSA public key size") ErrDataLen = errors.New("data length error") ErrDataBroken = errors.New("data broken, first byte is not zero") ErrKeyPairDismatch = errors.New("data is not encrypted by the private key") ErrDecryption = errors.New("decryption error") ErrPublicKey = errors.New("get public key error") ErrPrivateKey = errors.New("get private key error") )
Functions ¶
This section is empty.
Types ¶
type Ecc ¶
type Ecc struct {
// contains filtered or unexported fields
}
Ecc 椭圆曲线密码
func (*Ecc) GenerateEcdsaKey ¶
GenerateEcdsaKey 生成密钥和公钥
func (*Ecc) PrivateKeySignature ¶
PrivateKeySignature 私钥签名
func (*Ecc) PublicKeyVerify ¶
PublicKeyVerify 公钥验证
type RsaCrypto ¶
type RsaCrypto struct {
// contains filtered or unexported fields
}
JavaGenericRSA java的对接的rsa
func (*RsaCrypto) EqualPrivateKeyString ¶
EqualPrivateKeyString 对比密钥
func (*RsaCrypto) EqualPublicKeyString ¶
EqualPublicKeyString 对比公钥
func (*RsaCrypto) InitByGenerateKey ¶
func (grsa *RsaCrypto) InitByGenerateKey()
InitByGenerateKey 初始化
func (*RsaCrypto) PrivateKeyDecrypt ¶
PrivateKeyDecrypt 私钥解密
func (*RsaCrypto) PrivateKeyDecryptByte ¶
PrivateKeyDecryptByte 私钥解密
func (*RsaCrypto) PrivateKeyEncrypt ¶
PrivateKeyEncrypt 私钥加密
func (*RsaCrypto) PrivateKeyEncryptByte ¶
PrivateKeyEncryptByte 私钥加密
func (*RsaCrypto) PublicKeyDecrypt ¶
PublicKeyDecrypt 公钥解密
func (*RsaCrypto) PublicKeyDecryptByte ¶
PublicKeyDecryptByte 公钥解密
func (*RsaCrypto) PublicKeyEncrypt ¶
PublicKeyEncrypt 公钥加密
func (*RsaCrypto) PublicKeyEncryptByte ¶
PublicKeyEncryptByte 公钥加密
func (*RsaCrypto) SetPrivateKey ¶
SetPrivateKey 设置私钥
func (*RsaCrypto) SetPublicKey ¶
SetPublicKey 设置公钥
Click to show internal directories.
Click to hide internal directories.