Documentation ¶
Index ¶
- Variables
- type OAEPOptions
- type Opts
- type PBKDF2Opts
- type PKCS1v15DecryptOptions
- type RSA
- func FromBase64String(data string) RSA
- func FromBytes(data []byte) RSA
- func FromHexString(data string) RSA
- func FromPKCS12Cert(key []byte) RSA
- func FromPKCS12CertWithPassword(key []byte, password string) RSA
- func FromPKCS1PrivateKey(key []byte) RSA
- func FromPKCS1PrivateKeyWithPassword(key []byte, password string) RSA
- func FromPKCS1PublicKey(key []byte) RSA
- func FromPKCS8PrivateKey(key []byte) RSA
- func FromPKCS8PrivateKeyWithPassword(key []byte, password string) RSA
- func FromPKCS8PublicKey(key []byte) RSA
- func FromPrivateKey(key []byte) RSA
- func FromPrivateKeyWithPassword(key []byte, password string) RSA
- func FromPublicKey(key []byte) RSA
- func FromPublicKeyNE(nString string, eString string) RSA
- func FromString(data string) RSA
- func FromXMLPrivateKey(key []byte) RSA
- func FromXMLPublicKey(key []byte) RSA
- func GenerateKey(bits int) RSA
- func GenerateKeyWithSeed(reader io.Reader, bits int) RSA
- func GenerateMultiPrimeKey(nprimes int, bits int) RSA
- func GenerateMultiPrimeKeyWithSeed(reader io.Reader, nprimes int, bits int) RSA
- func New() RSA
- func NewRSA() RSA
- func (this RSA) AppendError(err ...error) RSA
- func (this RSA) CheckKeyPair() bool
- func (this RSA) CreatePKCS1PrivateKey() RSA
- func (this RSA) CreatePKCS1PrivateKeyWithPassword(password string, opts ...string) RSA
- func (this RSA) CreatePKCS1PublicKey() RSA
- func (this RSA) CreatePKCS8PrivateKey() RSA
- func (this RSA) CreatePKCS8PrivateKeyWithPassword(password string, opts ...any) RSA
- func (this RSA) CreatePKCS8PublicKey() RSA
- func (this RSA) CreatePrivateKey() RSA
- func (this RSA) CreatePrivateKeyWithPassword(password string, opts ...string) RSA
- func (this RSA) CreatePublicKey() RSA
- func (this RSA) CreateXMLPrivateKey() RSA
- func (this RSA) CreateXMLPublicKey() RSA
- func (this RSA) Decrypt() RSA
- func (this RSA) DecryptECB() RSA
- func (this RSA) DecryptECBWithOpts(opts crypto.DecrypterOpts) RSA
- func (this RSA) DecryptOAEP() RSA
- func (this RSA) DecryptOAEPECB() RSA
- func (this RSA) DecryptWithOpts(opts crypto.DecrypterOpts) RSA
- func (this RSA) Encrypt() RSA
- func (this RSA) EncryptECB() RSA
- func (this RSA) EncryptOAEP() RSA
- func (this RSA) EncryptOAEPECB() RSA
- func (this RSA) Error() error
- func (this RSA) FromBase64String(data string) RSA
- func (this RSA) FromBytes(data []byte) RSA
- func (this RSA) FromHexString(data string) RSA
- func (this RSA) FromPKCS12Cert(key []byte) RSA
- func (this RSA) FromPKCS12CertWithPassword(key []byte, password string) RSA
- func (this RSA) FromPKCS1PrivateKey(key []byte) RSA
- func (this RSA) FromPKCS1PrivateKeyDer(der []byte) RSA
- func (this RSA) FromPKCS1PrivateKeyWithPassword(key []byte, password string) RSA
- func (this RSA) FromPKCS1PublicKey(key []byte) RSA
- func (this RSA) FromPKCS1PublicKeyDer(der []byte) RSA
- func (this RSA) FromPKCS8PrivateKey(key []byte) RSA
- func (this RSA) FromPKCS8PrivateKeyDer(der []byte) RSA
- func (this RSA) FromPKCS8PrivateKeyWithPassword(key []byte, password string) RSA
- func (this RSA) FromPKCS8PublicKey(key []byte) RSA
- func (this RSA) FromPKCS8PublicKeyDer(der []byte) RSA
- func (this RSA) FromPrivateKey(key []byte) RSA
- func (this RSA) FromPrivateKeyWithPassword(key []byte, password string) RSA
- func (this RSA) FromPublicKey(key []byte) RSA
- func (this RSA) FromPublicKeyNE(nString string, eString string) RSA
- func (this RSA) FromString(data string) RSA
- func (this RSA) FromXMLPrivateKey(key []byte) RSA
- func (this RSA) FromXMLPublicKey(key []byte) RSA
- func (this RSA) GenerateKey(bits int) RSA
- func (this RSA) GenerateKeyWithSeed(reader io.Reader, bits int) RSA
- func (this RSA) GenerateMultiPrimeKey(nprimes int, bits int) RSA
- func (this RSA) GenerateMultiPrimeKeyWithSeed(reader io.Reader, nprimes int, bits int) RSA
- func (this RSA) GetData() []byte
- func (this RSA) GetErrors() []error
- func (this RSA) GetKeyData() []byte
- func (this RSA) GetOAEPHash() hash.Hash
- func (this RSA) GetOAEPLabel() []byte
- func (this RSA) GetParsedData() []byte
- func (this RSA) GetPrivateKey() *rsa.PrivateKey
- func (this RSA) GetPublicKey() *rsa.PublicKey
- func (this RSA) GetPublicKeyEString() string
- func (this RSA) GetPublicKeyNString() string
- func (this RSA) GetSignHash() crypto.Hash
- func (this RSA) GetVerify() bool
- func (this RSA) LowerSafeDecrypt() RSA
- func (this RSA) LowerSafeEncrypt() RSA
- func (this RSA) MakeKeyDer() RSA
- func (this RSA) MakePublicKey() RSA
- func (this RSA) OnError(fn RsaErrorFunc) RSA
- func (this RSA) ParsePKCS12CertFromPEMWithPassword(pfxData []byte, password string) (*rsa.PrivateKey, error)
- func (this RSA) ParsePKCS1PrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
- func (this RSA) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error)
- func (this RSA) ParsePKCS1PublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)
- func (this RSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
- func (this RSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error)
- func (this RSA) ParsePKCS8PublicKeyFromPEM(key []byte) (*rsa.PublicKey, error)
- func (this RSA) ParsePrivateKeyFromXML(key []byte) (*rsa.PrivateKey, error)
- func (this RSA) ParsePublicKeyFromXML(key []byte) (*rsa.PublicKey, error)
- func (this RSA) PrivateKeyEncrypt() RSA
- func (this RSA) PrivateKeyEncryptECB() RSA
- func (this RSA) PublicKeyDecrypt() RSA
- func (this RSA) PublicKeyDecryptECB() RSA
- func (this RSA) SetKeyData(data string) RSA
- func (this RSA) SetOAEPHash(name string) RSA
- func (this RSA) SetOAEPLabel(data string) RSA
- func (this RSA) SetSignHash(name string) RSA
- func (this RSA) Sign() RSA
- func (this RSA) SignPSS(opts ...rsa.PSSOptions) RSA
- func (this RSA) ToBase64String() string
- func (this RSA) ToBytes() []byte
- func (this RSA) ToHexString() string
- func (this RSA) ToKeyBytes() []byte
- func (this RSA) ToKeyString() string
- func (this RSA) ToString() string
- func (this RSA) ToVerify() bool
- func (this RSA) ToVerifyInt() int
- func (this RSA) Verify(data []byte) RSA
- func (this RSA) VerifyPSS(data []byte, opts ...rsa.PSSOptions) RSA
- func (this RSA) WithData(data []byte) RSA
- func (this RSA) WithError(errs []error) RSA
- func (this RSA) WithKeyData(data []byte) RSA
- func (this RSA) WithOAEPHash(h hash.Hash) RSA
- func (this RSA) WithOAEPLabel(data []byte) RSA
- func (this RSA) WithParsedData(data []byte) RSA
- func (this RSA) WithPrivateKey(data *rsa.PrivateKey) RSA
- func (this RSA) WithPublicKey(data *rsa.PublicKey) RSA
- func (this RSA) WithSignHash(h crypto.Hash) RSA
- func (this RSA) WithVerify(data bool) RSA
- type RsaErrorFunc
- type ScryptOpts
Constants ¶
This section is empty.
Variables ¶
var ( // 获取 Cipher 类型 GetCipherFromName = pkcs8.GetCipherFromName // 获取 hash 类型 GetHashFromName = pkcs8.GetHashFromName )
Functions ¶
This section is empty.
Types ¶
type OAEPOptions ¶ added in v1.0.2054
type OAEPOptions = rsa.OAEPOptions
OAEPOptions is an interface for passing options to OAEP decryption using the crypto.Decrypter interface.
type PKCS1v15DecryptOptions ¶ added in v1.0.2054
type PKCS1v15DecryptOptions = rsa.PKCS1v15DecryptOptions
PKCS1v15DecryptOptions is for passing options to PKCS #1 v1.5 decryption using the crypto.Decrypter interface.
type RSA ¶ added in v1.0.2048
type RSA struct { // 错误 Errors []error // contains filtered or unexported fields }
*
- RSA 加密 *
- @create 2021-8-28
- @author deatil
func FromPKCS12CertWithPassword ¶ added in v1.0.1018
Pkcs12Cert 带密码
func FromPKCS1PrivateKeyWithPassword ¶ added in v1.0.1018
PKCS1 私钥带密码
func FromPKCS8PrivateKeyWithPassword ¶ added in v1.0.1018
PKCS8 私钥带密码
func FromPrivateKeyWithPassword ¶ added in v1.0.1018
私钥带密码
func FromPublicKeyNE ¶ added in v1.0.2028
公钥
func GenerateKey ¶ added in v1.0.1018
生成密钥 bits = 512 | 1024 | 2048 | 4096
func GenerateKeyWithSeed ¶ added in v1.0.2026
生成密钥 bits = 512 | 1024 | 2048 | 4096
func GenerateMultiPrimeKey ¶ added in v1.0.1051
生成密钥
func GenerateMultiPrimeKeyWithSeed ¶ added in v1.0.2026
生成密钥
func (RSA) CreatePKCS1PrivateKey ¶ added in v1.0.2048
生成 PKCS1 私钥
func (RSA) CreatePKCS1PrivateKeyWithPassword ¶ added in v1.0.2048
生成 PKCS1 私钥带密码 pem 数据 CreatePKCS1PrivateKeyWithPassword("123", "AES256CBC") PEMCipher: DESCBC | DESEDE3CBC | AES128CBC | AES192CBC | AES256CBC
func (RSA) CreatePKCS1PublicKey ¶ added in v1.0.2048
生成 pcks1 公钥 pem 数据
func (RSA) CreatePKCS8PrivateKey ¶ added in v1.0.2048
生成 PKCS8 私钥 pem 数据
func (RSA) CreatePKCS8PrivateKeyWithPassword ¶ added in v1.0.2048
生成 PKCS8 私钥带密码 pem 数据 CreatePKCS8PrivateKeyWithPassword("123", "AES256CBC", "SHA256")
func (RSA) CreatePKCS8PublicKey ¶ added in v1.0.2048
生成公钥 pem 数据
func (RSA) CreatePrivateKey ¶ added in v1.0.2048
生成私钥 pem 数据, PKCS1 别名 使用: obj := New().GenerateKey(2048) priKey := obj.CreatePrivateKey().ToKeyString()
func (RSA) CreatePrivateKeyWithPassword ¶ added in v1.0.2048
生成私钥带密码 pem 数据, PKCS1 别名
func (RSA) CreateXMLPrivateKey ¶ added in v1.0.2048
生成私钥 xml 数据
func (RSA) CreateXMLPublicKey ¶ added in v1.0.2048
生成公钥 xml 数据
func (RSA) DecryptECBWithOpts ¶ added in v1.0.2054
func (this RSA) DecryptECBWithOpts(opts crypto.DecrypterOpts) RSA
私钥解密, ECB 模式
func (RSA) DecryptOAEPECB ¶ added in v1.0.2048
OAEP私钥解密, ECB 模式
func (RSA) DecryptWithOpts ¶ added in v1.0.2053
func (this RSA) DecryptWithOpts(opts crypto.DecrypterOpts) RSA
私钥解密带设置
func (RSA) EncryptOAEPECB ¶ added in v1.0.2048
OAEP公钥加密, ECB 模式
func (RSA) FromBase64String ¶ added in v1.0.2048
Base64
func (RSA) FromPKCS12Cert ¶ added in v1.0.2048
Pkcs12 Cert
func (RSA) FromPKCS12CertWithPassword ¶ added in v1.0.2048
Pkcs12CertWithPassword
func (RSA) FromPKCS1PrivateKey ¶ added in v1.0.2048
Pkcs1
func (RSA) FromPKCS1PrivateKeyDer ¶ added in v1.0.2048
Pkcs1 DER
func (RSA) FromPKCS1PrivateKeyWithPassword ¶ added in v1.0.2048
Pkcs1WithPassword
func (RSA) FromPKCS1PublicKey ¶ added in v1.0.2048
PKCS1 公钥
func (RSA) FromPKCS1PublicKeyDer ¶ added in v1.0.2048
PKCS1 DER 公钥
func (RSA) FromPKCS8PrivateKey ¶ added in v1.0.2048
Pkcs8
func (RSA) FromPKCS8PrivateKeyDer ¶ added in v1.0.2048
Pkcs8 DER
func (RSA) FromPKCS8PrivateKeyWithPassword ¶ added in v1.0.2048
Pkcs8WithPassword
func (RSA) FromPKCS8PublicKey ¶ added in v1.0.2048
PKCS8 公钥
func (RSA) FromPKCS8PublicKeyDer ¶ added in v1.0.2048
PKCS8 DER 公钥
func (RSA) FromPrivateKeyWithPassword ¶ added in v1.0.2048
私钥带密码
func (RSA) FromPublicKeyNE ¶ added in v1.0.2048
模数、指数生成公钥 指数默认为 0x10001(65537)
func (RSA) FromXMLPrivateKey ¶ added in v1.0.2048
XML 私钥
func (RSA) FromXMLPublicKey ¶ added in v1.0.2048
XML 公钥
func (RSA) GenerateKey ¶ added in v1.0.2048
生成密钥 bits = 512 | 1024 | 2048 | 4096
func (RSA) GenerateKeyWithSeed ¶ added in v1.0.2048
生成密钥 bits = 512 | 1024 | 2048 | 4096
func (RSA) GenerateMultiPrimeKey ¶ added in v1.0.2048
生成密钥
func (RSA) GenerateMultiPrimeKeyWithSeed ¶ added in v1.0.2048
生成密钥
func (RSA) GetPrivateKey ¶ added in v1.0.2048
func (this RSA) GetPrivateKey() *rsa.PrivateKey
获取 PrivateKey
func (RSA) GetPublicKey ¶ added in v1.0.2048
获取 PublicKey
func (RSA) GetPublicKeyEString ¶ added in v1.0.2071
获取 PublicKeyE
func (RSA) GetPublicKeyNString ¶ added in v1.0.2071
获取 PublicKeyN
func (RSA) LowerSafeDecrypt ¶ added in v1.0.2053
私钥解密 rsa no padding decrypt
func (RSA) LowerSafeEncrypt ¶ added in v1.0.2053
公钥加密 rsa no padding encrypt
func (RSA) ParsePKCS12CertFromPEMWithPassword ¶ added in v1.0.2048
func (this RSA) ParsePKCS12CertFromPEMWithPassword(pfxData []byte, password string) (*rsa.PrivateKey, error)
解析 pkf 证书
func (RSA) ParsePKCS1PrivateKeyFromPEM ¶ added in v1.0.2048
func (this RSA) ParsePKCS1PrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
解析 PKCS1 私钥
func (RSA) ParsePKCS1PrivateKeyFromPEMWithPassword ¶ added in v1.0.2048
func (this RSA) ParsePKCS1PrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error)
解析 PKCS1 带密码的私钥
func (RSA) ParsePKCS1PublicKeyFromPEM ¶ added in v1.0.2048
解析 PKCS1 公钥
func (RSA) ParsePKCS8PrivateKeyFromPEM ¶ added in v1.0.2048
func (this RSA) ParsePKCS8PrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error)
解析 PKCS8 私钥
func (RSA) ParsePKCS8PrivateKeyFromPEMWithPassword ¶ added in v1.0.2048
func (this RSA) ParsePKCS8PrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error)
解析 PKCS8 带密码的私钥
func (RSA) ParsePKCS8PublicKeyFromPEM ¶ added in v1.0.2048
解析 PKCS8 公钥
func (RSA) ParsePrivateKeyFromXML ¶ added in v1.0.2048
func (this RSA) ParsePrivateKeyFromXML(key []byte) (*rsa.PrivateKey, error)
解析 xml 私钥
func (RSA) ParsePublicKeyFromXML ¶ added in v1.0.2048
解析 xml 公钥
func (RSA) PrivateKeyEncryptECB ¶ added in v1.0.2048
私钥加密, ECB 模式
func (RSA) PublicKeyDecryptECB ¶ added in v1.0.2048
公钥解密, ECB 模式
func (RSA) SetOAEPHash ¶ added in v1.0.2053
设置 oaepHash 类型
func (RSA) SetOAEPLabel ¶ added in v1.0.2053
设置 oaepLabel
func (RSA) SignPSS ¶ added in v1.0.2048
func (this RSA) SignPSS(opts ...rsa.PSSOptions) RSA
私钥签名 常用为: PS256[SHA256] | PS384[SHA384] | PS512[SHA512]
func (RSA) VerifyPSS ¶ added in v1.0.2048
func (this RSA) VerifyPSS(data []byte, opts ...rsa.PSSOptions) RSA
公钥验证 使用原始数据[data]对比签名后数据
func (RSA) WithOAEPHash ¶ added in v1.0.2053
设置 oaepHash
func (RSA) WithOAEPLabel ¶ added in v1.0.2053
设置 oaepLabel
func (RSA) WithParsedData ¶ added in v1.0.2049
设置 parsedData
func (RSA) WithPrivateKey ¶ added in v1.0.2048
func (this RSA) WithPrivateKey(data *rsa.PrivateKey) RSA
设置 PrivateKey
func (RSA) WithPublicKey ¶ added in v1.0.2048
设置 PublicKey
func (RSA) WithSignHash ¶ added in v1.0.2048
设置 hash 类型