Documentation ¶
Index ¶
- Constants
- func AESDecrypt(crypted, key []byte, mod AESMOD) ([]byte, error)
- func AESDecryptIV(crypted, key, iv []byte, mod AESMOD) ([]byte, error)
- func AESEncrypt(origData, key []byte, mod AESMOD) ([]byte, error)
- func AESEncryptIV(origData, key, iv []byte, mod AESMOD) ([]byte, error)
- func DecodeBase64(cipherdata []byte) []byte
- func DecodeHex(hexdata []byte) []byte
- func DesDecrypt(crypted, key []byte) ([]byte, error)
- func DesEncrypt(origData, key []byte) ([]byte, error)
- func DoubleDesDecrypt(crypted, key []byte) ([]byte, error)
- func DoubleDesEncrypt(origData, key []byte) ([]byte, error)
- func EncodeBase64(origdata []byte) []byte
- func EncodeHex(origdata []byte) []byte
- func GenMACANSI99(origData, key []byte) ([]byte, error)
- func GenMd5(origData []byte) string
- func GenMd5HEX(origData []byte) string
- func GetFileMd5(filename string) (string, error)
- func GetMd5(origData []byte) []byte
- func HMacMD5(origData, key []byte) []byte
- func Hash(algo int, hashbuf []byte) ([]byte, error)
- func NewECBDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func TripleDesDecrypt(crypted, key []byte) ([]byte, error)
- func TripleDesEncrypt(origData, key []byte) ([]byte, error)
- func TripleEcbDesDecrypt(crypted, key []byte) ([]byte, error)
- func TripleEcbDesEncrypt(origData, key []byte) ([]byte, error)
- func VerifyMd5(origData []byte, desKey string) bool
- type AESMOD
- type CertInfo
- func (cert *CertInfo) DecryptPKCS1v15(cipherdata []byte) ([]byte, error)
- func (cert *CertInfo) EncryptPKCS1v15(origdata []byte) ([]byte, error)
- func (cert *CertInfo) SerialNumber() string
- func (cert *CertInfo) Sign(algo int, signbuf []byte) ([]byte, error)
- func (cert *CertInfo) Verify(algo int, signbuf []byte, signature []byte) error
- type CliCert
- type RSAKey
- func LoadFromRSAPrivate(priv *rsa.PrivateKey) (*RSAKey, error)
- func LoadFromRSAPublic(pub *rsa.PublicKey) (*RSAKey, error)
- func LoadRSAPrivatePEM(buf string) (*RSAKey, error)
- func LoadRSAPubicPEM(buf string) (*RSAKey, error)
- func NewRSA(jsonConfig string) (*RSAKey, error)
- func NewRSAInMap(cfg map[string]string) (*RSAKey, error)
- func NewRSAOfCer(cfg map[string]string) (*RSAKey, error)
- func (r *RSAKey) DecryptPKCS1v15(cipherdata []byte) ([]byte, error)
- func (r *RSAKey) DecryptPKCS1v15PUB(cipherdata []byte) ([]byte, error)
- func (r *RSAKey) EncryptPKCS1v15(origdata []byte) ([]byte, error)
- func (r *RSAKey) EncryptPKCS1v15PRI(origdata []byte) ([]byte, error)
- func (r *RSAKey) GetModules() int
- func (r *RSAKey) Sha1(signbuf []byte) []byte
- func (r *RSAKey) Sign(algo int, signbuf []byte) ([]byte, error)
- func (r *RSAKey) Verify(algo int, signbuf []byte, signature []byte) error
Constants ¶
View Source
const ( //证书RSA FILE_CERT_CER = "FILE_CERT_CER" FILE_CERT_PFX = "FILE_CERT_PFX" //公私钥 FILE_RSA_PEM_PUB = "PEM-RSA-PUB" FILE_RSA_PEM_PRIV = "PEM-RSA-PRIV" FILE_RSA_PKCS8_PRIV = "FILE_RSA_PKCS8_PRIV" )
View Source
const ( UnknownSignatureAlgorithm int = iota MD2WithRSA MD5WithRSA SHA1WithRSA SHA256WithRSA SHA384WithRSA SHA512WithRSA DSAWithSHA1 DSAWithSHA256 ECDSAWithSHA1 ECDSAWithSHA256 ECDSAWithSHA384 ECDSAWithSHA512 )
View Source
const IV = "\x00\x00\x00\x00\x00\x00\x00\x00"
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64 ¶
func DesDecrypt ¶
func DesEncrypt ¶
func EncodeBase64 ¶
func GenMACANSI99 ¶
func GetFileMd5 ¶
func NewECBDecrypter ¶
NewECBDecrypter returns a BlockMode which decrypts in electronic code book mode, using the given cipher.Block.
func NewECBEncrypter ¶
NewECBEncrypter returns a BlockMode which encrypts in electronic code book mode, using the given cipher.Block.
func TripleEcbDesDecrypt ¶
[golang ECB 3DES Decrypt]
func TripleEcbDesEncrypt ¶
Types ¶
type CertInfo ¶
type CertInfo struct { KeyType string KeyFile string KeyPass string // contains filtered or unexported fields }
func NewCertInfoCer ¶
func (*CertInfo) DecryptPKCS1v15 ¶
私钥解密
func (*CertInfo) EncryptPKCS1v15 ¶
公钥加密:
type CliCert ¶
type CliCert struct { KeyType string `json:"key_type"` KeyFile string `json:"key_file"` SerialNumber string `json:"serial_number"` X509Cert *x509.Certificate PublicKey interface{} PublicKeyAlgorithm x509.PublicKeyAlgorithm }
func NewCliCert ¶
func (*CliCert) EncryptPKCS1v15 ¶
签名公钥加密:
type RSAKey ¶
type RSAKey struct { KeyType string `json:"key_type"` KeyFile string `json:"key_file"` PublicKey *rsa.PublicKey PrivateKey *rsa.PrivateKey Modules int }
func (*RSAKey) DecryptPKCS1v15 ¶
func (*RSAKey) DecryptPKCS1v15PUB ¶
func (*RSAKey) EncryptPKCS1v15PRI ¶
func (*RSAKey) GetModules ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package pkcs12 implements some of PKCS#12.
|
Package pkcs12 implements some of PKCS#12. |
internal/rc2
Package rc2 implements the RC2 cipher
|
Package rc2 implements the RC2 cipher |
Click to show internal directories.
Click to hide internal directories.