Documentation ¶
Index ¶
- func BuildSecretKey(keyValue string) string
- func BytePrivateKey(privateKey *ecdh.PrivateKey, password []byte) []byte
- func BytePublicKey(publicKey *ecdh.PublicKey) []byte
- func Decrypt(keyValue interface{}, passphrase []byte, ciphertext []byte) []byte
- func DecryptKey(keyValue []byte, privateKey *ecdh.PrivateKey) []byte
- func DecryptSymmetrical(key []byte, ciphertext []byte) []byte
- func Encrypt(keyValue interface{}, plaintext []byte) []byte
- func EncryptKey(key []byte, publicKey *ecdh.PublicKey) []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 *ecdh.PrivateKey, password []byte) *ecdh.PrivateKey
- func GetPublicKey(keyPair *ecdh.PrivateKey) (key *ecdh.PublicKey)
- func LoadPrivateKey(keyValue interface{}, password string) *ecdh.PrivateKey
- func LoadPublicKey(keyValue interface{}) *ecdh.PublicKey
- func ReadSecretKey(keyPacket []byte, privateKey *ecdh.PrivateKey, password []byte) []byte
- func Sign(privateKey *ed25519.PrivateKey, passphrase []byte, plaintext []byte) (ciphertext []byte)
- func ValidateKey(keyPair *ecdh.PublicKey, password []byte) bool
- func Verify(publicKey *ed25519.PublicKey, plaintext []byte, ciphertext []byte) (success bool)
- func WritePrivateKey(privateKey *ecdh.PrivateKey, password []byte) string
- func WritePublicKey(publicKey *ecdh.PublicKey) string
- func WriteSecretKey(sessionKey []byte, publicKey *ecdh.PublicKey, password []byte) []byte
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytePrivateKey ¶
func BytePrivateKey(privateKey *ecdh.PrivateKey, password []byte) []byte
func BytePublicKey ¶
func Decrypt ¶
*
- 非对称解密 *
- @param privkey 解密的密钥
- @param ciphertext 已经加密的数据
- @return 解密后的明文
- @throws EncryptException
func DecryptKey ¶
func DecryptKey(keyValue []byte, privateKey *ecdh.PrivateKey) []byte
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 GetPrivateKey ¶
func GetPrivateKey(keyPair *ecdh.PrivateKey, password []byte) *ecdh.PrivateKey
func GetPublicKey ¶
func GetPublicKey(keyPair *ecdh.PrivateKey) (key *ecdh.PublicKey)
func LoadPrivateKey ¶
func LoadPrivateKey(keyValue interface{}, password string) *ecdh.PrivateKey
*
- 从证书中的私钥二进制字符串表示中还原私钥 * *
- @param keyValue
- @return
func LoadPublicKey ¶
*
- 从公钥字符串,Key,KeyRing,表示中还原公钥 * *
- @param keyValue
- @return
- @throws NoSuchAlgorithmException
- @throws InvalidKeySpecException
func ReadSecretKey ¶
func ReadSecretKey(keyPacket []byte, privateKey *ecdh.PrivateKey, password []byte) []byte
func Sign ¶
func Sign(privateKey *ed25519.PrivateKey, passphrase []byte, plaintext []byte) (ciphertext []byte)
func WritePrivateKey ¶
func WritePrivateKey(privateKey *ecdh.PrivateKey, password []byte) string
func WritePublicKey ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.