Documentation ¶
Index ¶
- Constants
- type EncryptPadding
- type Encryptor
- type EncryptorOption
- func WithEncryptorBlockSize(blockSize int) EncryptorOption
- func WithEncryptorHash(hash hash.Hash) EncryptorOption
- func WithEncryptorLabel(label string) EncryptorOption
- func WithEncryptorPadding(padding EncryptPadding) EncryptorOption
- func WithEncryptorPrivateKey(privateKey string) EncryptorOption
- func WithEncryptorPublicKey(publicKey string) EncryptorOption
- type Format
- type Key
- type SignPadding
- type Signer
- type SignerOption
Constants ¶
View Source
const Name = "rsa"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncryptPadding ¶
type EncryptPadding string
EncryptPadding 加密填充算法
const ( NORMAL EncryptPadding = "NORMAL" // RSA_PKCS1_PADDING,数据切割加密长度算法为 OAEP EncryptPadding = "OAEP" // RSA_PKCS1_OAEP_PADDING,数据切割加密长度算法为:公共模数长度-(2*哈希长度的)-2 )
type Encryptor ¶
type Encryptor struct {
// contains filtered or unexported fields
}
func NewEncryptor ¶
func NewEncryptor(opts ...EncryptorOption) *Encryptor
type EncryptorOption ¶
type EncryptorOption func(o *encryptorOptions)
func WithEncryptorBlockSize ¶
func WithEncryptorBlockSize(blockSize int) EncryptorOption
WithEncryptorBlockSize 设置加密数据块大小
func WithEncryptorHash ¶
func WithEncryptorHash(hash hash.Hash) EncryptorOption
WithEncryptorHash 设置加密hash算法
func WithEncryptorLabel ¶
func WithEncryptorLabel(label string) EncryptorOption
WithEncryptorLabel 设置加密标签
func WithEncryptorPadding ¶
func WithEncryptorPadding(padding EncryptPadding) EncryptorOption
WithEncryptorPadding 设置加密填充规则
func WithEncryptorPrivateKey ¶
func WithEncryptorPrivateKey(privateKey string) EncryptorOption
WithEncryptorPrivateKey 设置解密私钥
func WithEncryptorPublicKey ¶
func WithEncryptorPublicKey(publicKey string) EncryptorOption
WithEncryptorPublicKey 设置加密公钥
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func (*Key) MarshalPrivateKey ¶
MarshalPrivateKey 编码私钥
func (*Key) MarshalPublicKey ¶
MarshalPublicKey 编码公钥
type SignPadding ¶
type SignPadding string
SignPadding 签名填充算法
const ( PKCS SignPadding = "PKCS" // RSA PKCS #1 v1.5 PSS SignPadding = "PSS" // RSA PSS )
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
func NewSigner ¶
func NewSigner(opts ...SignerOption) *Signer
type SignerOption ¶
type SignerOption func(o *signerOptions)
func WithSignerPadding ¶
func WithSignerPadding(padding SignPadding) SignerOption
WithSignerPadding 设置加密填充规则
func WithSignerPrivateKey ¶
func WithSignerPrivateKey(privateKey string) SignerOption
WithSignerPrivateKey 设置解密私钥
func WithSignerPublicKey ¶
func WithSignerPublicKey(publicKey string) SignerOption
WithSignerPublicKey 设置验签公钥
Click to show internal directories.
Click to hide internal directories.