Documentation ¶
Index ¶
- func Base64PrivateKeyPemWriter(base64Key string, writer io.Writer) error
- func Base64PrivateKeyToPem(base64Key string) (string, error)
- func Base64PrivateKeyToPemFile(base64Key string, pemPrivateFile string) error
- func Base64PublicKeyPemWriter(base64Key string, writer io.Writer) error
- func Base64PublicKeyToPem(base64Key string) (string, error)
- func Base64PublicKeyToPemFile(base64Key string, publicKeyFile string) error
- func DecodePem(pemData []byte) ([]byte, error)
- func Decrypt(data string, privateKey *rsa.PrivateKey) (string, error)
- func DecryptBase64(base64Data string, key *rsa.PrivateKey) (string, error)
- func DecryptBase64ByBase64Key(base64Data string, base64PriKey string) (string, error)
- func DecryptBase64ByPemFile(base64Data string, pemPrivateKeyFile string) (string, error)
- func DecryptBase64ByPemKey(base64Data string, pemPrivateKey string) (string, error)
- func DecryptBase64ByRawKey(base64Data string, rawPrivateKey []byte) (string, error)
- func DecryptByPemFile(data string, pemPrivateFile string) (string, error)
- func DecryptByPemKey(data string, pemPrivateKey string) (string, error)
- func DecryptByRawKey(data string, rawKey []byte) (string, error)
- func Encrypt(data string, publicKey *rsa.PublicKey) (string, error)
- func EncryptBase64(data string, key *rsa.PublicKey) (string, error)
- func EncryptBase64ByBase64key(data string, base64PubKey string) (string, error)
- func EncryptBase64ByPemFile(data string, pemPublicKeyFile string) (string, error)
- func EncryptBase64ByPemKey(data string, pemPublicKey string) (string, error)
- func EncryptBase64ByRawKey(data string, rawPublicKey []byte) (string, error)
- func EncryptByPemFile(data string, pemPublicFile string) (string, error)
- func EncryptByPemKey(data string, pemPublicKey string) (string, error)
- func EncryptByRawKey(data string, rawPublicKey []byte) (string, error)
- func GenRSAKeyPemFile(dir string, bits ...int) error
- func GenRSAKeyPemString(bits ...int) (priKey, pubKey string, err error)
- func GenRsaKey(keyLen ...int) (privateKey, publicKey []byte, err error)
- func GenRsaKeyBase64(keyLen ...int) (privateKey, publicKey string, err error)
- func GenRsaKeyPem(privateKeyOut io.Writer, publicKeyOut io.Writer, keyLen ...int) error
- func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte
- func ParseBase64PrivateKey(base64Key string) (*rsa.PrivateKey, error)
- func ParseBase64PublicKey(base64Key string) (*rsa.PublicKey, error)
- func ParsePrivateKey(key []byte) (*rsa.PrivateKey, error)
- func ParsePrivateKeyPem(key []byte) (*rsa.PrivateKey, error)
- func ParsePublicKey(key []byte) (*rsa.PublicKey, error)
- func ParsePublicKeyPem(key []byte) (*rsa.PublicKey, error)
- func PemPrivateKeyFileToBase64(pemPrivateKeyFile string) (string, error)
- func PemPrivateKeyToBase64(pemKey string) (string, error)
- func PemPublicKeyFileToBase64(pemPublicKeyFile string) (string, error)
- func PemPublicKeyToBase64(pemKey string) (string, error)
- func PrivateKeyPemFromFile(fileName string) (*rsa.PrivateKey, error)
- func PrivateKeyPemFromReader(reader io.Reader) (*rsa.PrivateKey, error)
- func PrivateKeyToPem(key *rsa.PrivateKey) (string, error)
- func PrivateKeyToString(key *rsa.PrivateKey) (string, error)
- func PublicKeyPemFromFile(fileName string) (*rsa.PublicKey, error)
- func PublicKeyPemFromReader(reader io.Reader) (*rsa.PublicKey, error)
- func PublicKeyToPem(key *rsa.PublicKey) (string, error)
- func PublicKeyToString(key *rsa.PublicKey) (string, error)
- func Sign(data string, pemPrivateKey *rsa.PrivateKey) (string, error)
- func SignBase64(data string, key *rsa.PrivateKey) (string, error)
- func SignBase64ByBase64Key(data string, base64PriKey string) (string, error)
- func SignBase64ByPemFile(data string, pemPriKeyFile string) (string, error)
- func SignBase64ByPemKey(data string, pemPriKey string) (string, error)
- func SignBase64ByRawKey(data string, rawPriKey []byte) (string, error)
- func SignByPemFile(data string, pemPrivateKeyFile string) (string, error)
- func SignByPemKey(data string, pemPrivateKey string) (string, error)
- func SignByRawKey(data string, rawPrivateKey []byte) (string, error)
- func Verify(data string, sign string, pemPublicKey *rsa.PublicKey) (bool, error)
- func VerifyBase64(data string, base64Sign string, key *rsa.PublicKey) (bool, error)
- func VerifyBase64ByBase64Key(data string, base64Sign string, base64PubKey string) (bool, error)
- func VerifyBase64ByPemFile(data string, base64Sign string, pemPubKeyFile string) (bool, error)
- func VerifyBase64ByPemKey(data string, base64Sign string, pemPubKey string) (bool, error)
- func VerifyBase64ByRawKey(data string, base64Sign string, rawPubKey []byte) (bool, error)
- func VerifyByPemFile(data string, sign string, pemPublicKeyFile string) (bool, error)
- func VerifyByPemKey(data string, sign string, pemPublicKey string) (bool, error)
- func VerifyByRawKey(data string, sign string, rawPublicKey []byte) (bool, error)
- type TRSA
- func NewRSA(priPubKey ...interface{}) (*TRSA, error)
- func NewRSAByBase64(publicKey string, privateKey string) (*TRSA, error)
- func NewRSAByPem(publicKey []byte, privateKey []byte) (*TRSA, error)
- func NewRSAByPemFile(publicKeyFile, privateKeyFile string) (*TRSA, error)
- func NewRSAByRaw(publicKey []byte, privateKey []byte) (*TRSA, error)
- func (rsa *TRSA) Decrypt(encData string) (string, error)
- func (rsa *TRSA) DecryptBase64(base64Data string) (string, error)
- func (rsa *TRSA) Encrypt(data string) (string, error)
- func (rsa *TRSA) EncryptBase64(data string) (string, error)
- func (rsa *TRSA) NewKeys() (privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, err error)
- func (rsa *TRSA) PrivateKey() *rsa.PrivateKey
- func (rsa *TRSA) PublicKey() *rsa.PublicKey
- func (rsa *TRSA) Sign(data string) (string, error)
- func (rsa *TRSA) SignBase64(data string) (string, error)
- func (rsa *TRSA) Verify(data string, sign string) (bool, error)
- func (rsa *TRSA) VerifyBase64(data string, base64Sign string) (bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64PrivateKeyToPem ¶
func Base64PublicKeyPemWriter ¶
base64编码的公钥转成pem编码
func Base64PublicKeyToPem ¶
base64编码的公钥转码成pem的字符串
func Base64PublicKeyToPemFile ¶
base64编码的公钥转存为pem文件
func DecryptBase64 ¶
func DecryptBase64(base64Data string, key *rsa.PrivateKey) (string, error)
func DecryptBase64ByPemFile ¶
func DecryptBase64ByPemKey ¶
func DecryptBase64ByRawKey ¶
func DecryptByPemFile ¶
使用pem编码的私钥文件解密data数据
func DecryptByPemKey ¶
使用pem编码的私钥字符串解密data数据
func DecryptByRawKey ¶
使用私钥字符串解密data数据
func EncryptBase64ByPemFile ¶
func EncryptBase64ByPemKey ¶
func EncryptBase64ByRawKey ¶
func EncryptByPemFile ¶
使用pem编码的公钥文件加密data数据
func EncryptByPemKey ¶
使用pem编码的公钥字符串加密data数据
func EncryptByRawKey ¶
使用公钥字符串加密data数据
func GenRSAKeyPemFile ¶
func GenRSAKeyPemString ¶
func GenRsaKeyBase64 ¶
func GenRsaKeyPem ¶
生成rsa公私钥pem
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) []byte
func ParseBase64PrivateKey ¶
func ParseBase64PrivateKey(base64Key string) (*rsa.PrivateKey, error)
func ParsePublicKey ¶
解析rsa公钥, key为已经解码的pem数据
func ParsePublicKeyPem ¶
解析rsa公钥,key为pem编码的公钥字符串数据
func PemPrivateKeyToBase64 ¶
func PemPublicKeyToBase64 ¶
func PrivateKeyPemFromFile ¶
func PrivateKeyPemFromFile(fileName string) (*rsa.PrivateKey, error)
从编码为pem的文件解析rsa私钥
func PrivateKeyPemFromReader ¶
func PrivateKeyPemFromReader(reader io.Reader) (*rsa.PrivateKey, error)
从编码为pem的阅读器解析rsa私钥
func PrivateKeyToString ¶
func PrivateKeyToString(key *rsa.PrivateKey) (string, error)
func PublicKeyPemFromFile ¶
从编码为pem的文件解析rsa公钥
func PublicKeyPemFromReader ¶
从编码为pem的阅读器中解析rsa公钥
func SignBase64 ¶
func SignBase64(data string, key *rsa.PrivateKey) (string, error)
func SignBase64ByBase64Key ¶
func SignBase64ByPemFile ¶
func VerifyBase64 ¶
func VerifyBase64ByBase64Key ¶
func VerifyBase64ByPemFile ¶
func VerifyBase64ByPemKey ¶
func VerifyBase64ByRawKey ¶
func VerifyByPemFile ¶
func VerifyByPemKey ¶
Types ¶
type TRSA ¶
type TRSA struct {
// contains filtered or unexported fields
}
func NewRSAByBase64 ¶
从base64编码的密钥对中创建rsa实例
func NewRSAByPem ¶
从pem编码的密钥对创建rsa实例
func NewRSAByPemFile ¶
func NewRSAByRaw ¶
从原始密码对数据创建rsa实例
func (*TRSA) DecryptBase64 ¶
使用私钥解密base64编码的数据
func (*TRSA) EncryptBase64 ¶
使用公钥加密数据并以base64 urlEncode编码后返回
Click to show internal directories.
Click to hide internal directories.