Documentation ¶
Index ¶
Constants ¶
View Source
const Name = "rsa"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decryptor ¶
type Decryptor struct {
// contains filtered or unexported fields
}
func NewDecryptor ¶
func NewDecryptor(opts ...DecryptorOption) *Decryptor
type DecryptorOption ¶
type DecryptorOption func(o *decryptorOptions)
func WithDecryptorHash ¶
func WithDecryptorHash(hash hash.Hash) DecryptorOption
WithDecryptorHash 设置解密hash算法
func WithDecryptorLabel ¶
func WithDecryptorLabel(label string) DecryptorOption
WithDecryptorLabel 设置解密标签
func WithDecryptorPadding ¶
func WithDecryptorPadding(padding EncryptPadding) DecryptorOption
WithDecryptorPadding 设置解密填充规则
func WithDecryptorPrivateKey ¶
func WithDecryptorPrivateKey(privateKey string) DecryptorOption
WithDecryptorPrivateKey 设置解密私钥
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 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 设置解密私钥
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}
func NewVerifier ¶
func NewVerifier(opts ...VerifierOption) *Verifier
type VerifierOption ¶
type VerifierOption func(o *verifierOption)
func WithVerifierHash ¶
func WithVerifierHash(hash hash.Hash) VerifierOption
WithVerifierHash 设置加密hash算法
func WithVerifierPadding ¶
func WithVerifierPadding(padding SignPadding) VerifierOption
WithVerifierPadding 设置加密填充规则
func WithVerifierPublicKey ¶
func WithVerifierPublicKey(publicKey string) VerifierOption
WithVerifierPublicKey 设置验签公钥
Click to show internal directories.
Click to hide internal directories.