rsa

package
v0.2.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package rsa implements crypto/rsa

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair defines a KeyPair struct. 定义 KeyPair 结构体

func NewKeyPair

func NewKeyPair() *KeyPair

NewKeyPair returns a new KeyPair instance. 初始化 keyPair 结构体

func (*KeyPair) DecryptByPrivateKey

func (k *KeyPair) DecryptByPrivateKey(src []byte) (dst []byte, err error)

DecryptByPrivateKey encrypts by private key. 通过私钥解密

func (*KeyPair) DecryptByPublicKey

func (k *KeyPair) DecryptByPublicKey(src []byte) (dst []byte, err error)

DecryptByPublicKey encrypts by public key. 通过公钥解密

func (*KeyPair) EncryptByPrivateKey

func (k *KeyPair) EncryptByPrivateKey(src []byte) (dst []byte, err error)

EncryptByPrivateKey encrypts by private key. 通过私钥加密

func (*KeyPair) EncryptByPublicKey

func (k *KeyPair) EncryptByPublicKey(src []byte) (dst []byte, err error)

EncryptByPublicKey encrypts by public key. 通过公钥加密

func (*KeyPair) IsPrivateKey added in v0.2.6

func (k *KeyPair) IsPrivateKey() bool

IsPrivateKey whether is a private key. 是否是私钥

func (*KeyPair) IsPublicKey added in v0.2.6

func (k *KeyPair) IsPublicKey() bool

IsPublicKey whether is a public key. 是否是公钥

func (*KeyPair) IsSupportedHash added in v0.2.6

func (k *KeyPair) IsSupportedHash() bool

IsSupportedHash whether is a supported hash algorithm. 判断是否是支持的哈希算法

func (*KeyPair) SetHash

func (k *KeyPair) SetHash(hash crypto.Hash)

SetHash sets hash algorithm. 设置哈希算法

func (*KeyPair) SetPrivateKey

func (k *KeyPair) SetPrivateKey(privateKey []byte)

SetPrivateKey sets private key. 设置私钥

func (*KeyPair) SetPublicKey

func (k *KeyPair) SetPublicKey(publicKey []byte)

SetPublicKey sets public key. 设置公钥

func (*KeyPair) SignByPrivateKey

func (k *KeyPair) SignByPrivateKey(src []byte) (dst []byte, err error)

SignByPrivateKey signs by private key. 通过私钥签名

func (*KeyPair) VerifyByPublicKey

func (k *KeyPair) VerifyByPublicKey(src, sign []byte) (err error)

VerifyByPublicKey verify by public key. 通过公钥验签

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL