Documentation ¶
Index ¶
- Constants
- Variables
- func CreateKeys(publicKeyWriter, privateKeyWriter io.Writer, keyLengths ...int) error
- func CreateKeysToBase64(keyLengths ...int) (string, string, error)
- func CreateKeysToBytes(keyLengths ...int) ([]byte, []byte, error)
- func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) ([]byte, error)
- type XRsa
- func (r *XRsa) Decrypt(encrypted []byte) ([]byte, error)
- func (r *XRsa) DecryptFromBase64(encrypted string) ([]byte, error)
- func (r *XRsa) Encrypt(data []byte) ([]byte, error)
- func (r *XRsa) EncryptToBase64(data []byte) (string, error)
- func (r *XRsa) Sign(data []byte) ([]byte, error)
- func (r *XRsa) SignToBase64(data []byte) (string, error)
- func (r *XRsa) Verify(data []byte, sign []byte) error
- func (r *XRsa) VerifyFromBase64(data []byte, sign string) error
Constants ¶
View Source
const ( CharSet = "UTF-8" Base64Format = "UrlSafeNoPadding" AlgorithmKeyType = "PKCS1" AlgorithmSign = crypto.SHA256 Bits = 2048 )
Variables ¶
View Source
var Base64Encoding *base64.Encoding
Functions ¶
func CreateKeys ¶
生成密钥对
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) ([]byte, error)
Types ¶
Click to show internal directories.
Click to hide internal directories.