Documentation ¶
Index ¶
- func BuildSecretKey(keyValue string) string
- func BytePrivateKey(privateKey *crypto.Key, password []byte) []byte
- func BytePublicKey(publicKey *crypto.Key) []byte
- func Decrypt(keyValue interface{}, passphrase []byte, ciphertext []byte) []byte
- func DecryptKey(keyValue []byte, privateKey *crypto.Key) []byte
- func DecryptSymmetrical(key []byte, ciphertext []byte) []byte
- func Encrypt(keyValue interface{}, plaintext []byte) (ciphertext []byte)
- func EncryptKey(key []byte, publicKey *crypto.Key) []byte
- func EncryptSymmetrical(key []byte, plaintext []byte) []byte
- func GenerateKeyPair(keyType string, passphrase []byte, armored bool, name string, email string) interface{}
- func GenerateSecretKey(size int) (sessionKey interface{})
- func GetPrivateKey(keyPair *crypto.Key, password []byte) *crypto.Key
- func GetPublicKey(keyPair *crypto.Key) (key *crypto.Key)
- func LoadPrivateKey(keyValue interface{}, password string) (*crypto.Key, error)
- func LoadPublicKey(keyValue interface{}) (*crypto.Key, error)
- func ReadSecretKey(keyPacket []byte, privateKey *crypto.Key, password []byte) *crypto.SessionKey
- func Sign(privateKey *crypto.Key, passphrase []byte, plaintext []byte) (ciphertext []byte)
- func ValidateKey(keyPair *crypto.Key, password []byte) bool
- func Verify(publicKey *crypto.Key, plaintext []byte, ciphertext []byte) (success bool)
- func WritePrivateKey(privateKey *crypto.Key, password []byte) string
- func WritePublicKey(publicKey *crypto.Key) string
- func WriteSecretKey(sessionKey *crypto.SessionKey, publicKey *crypto.Key, password []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytePublicKey ¶
func Decrypt ¶
*
- 非对称解密 *
- @param privkey 解密的密钥
- @param ciphertext 已经加密的数据
- @return 解密后的明文
- @throws EncryptException
func DecryptSymmetrical ¶
*
- 非对称解密 *
- @param key 解密的密钥
- @param raw 已经加密的数据
- @return 解密后的明文
- @throws EncryptException
func Encrypt ¶
*
- 非对称加密 *
- @param key 加密的密钥
- @param data 待加密的明文数据
- @return 加密后的数据
- @throws EncryptException
func EncryptSymmetrical ¶
*
- 对称加密 *
- @param key 加密的密钥
- @param data 待加密的明文数据
- @return 加密后的数据
- @throws EncryptException
func GenerateKeyPair ¶
func GenerateKeyPair(keyType string, passphrase []byte, armored bool, name string, email string) interface{}
*
- 生成非对称的密钥对 *
- @return
func GenerateSecretKey ¶
func GenerateSecretKey(size int) (sessionKey interface{})
*
- 生成随机对称秘钥 *
- @param algorithm
- @return
- @throws NoSuchAlgorithmException
func LoadPublicKey ¶
*
- 从公钥字符串,Key,KeyRing,表示中还原公钥 * *
- @param keyValue
- @return
- @throws NoSuchAlgorithmException
- @throws InvalidKeySpecException
func ReadSecretKey ¶
func WritePublicKey ¶
func WriteSecretKey ¶
* 对对称密钥用对方公钥加密
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.