Versions in this module Expand all Collapse all v0 v0.1.1 Dec 2, 2021 Changes in this version + var OidPublicKeyECDSAOrSM2 = asn1.ObjectIdentifier + var OidPublicKeyRSA = asn1.ObjectIdentifier + func GetCryptoEngine() crypto.Engine + func GetPublicKeyAlgorithmFromMode(mode int) (pkix.AlgorithmIdentifier, error) + func GetSoftwareEngine(keyStoreAbsPath string) crypto.Engine + func MarshalECPrivateKey(key *asym.ECDSAPrivateKey) ([]byte, error) + func MarshalPKCS1PrivateKey(key *rsa.PrivateKey) []byte + func MarshalPKCS1PublicKey(key *rsa.PublicKey) []byte + func MarshalPKCS8PrivateKey(key *PrivateKey) ([]byte, error) + func MarshalPKIXPublicKey(rawpub []byte, mode int) ([]byte, error) + func MarshalSMPrivateKey(x *gm.SM2PrivateKey, withPKCS8 bool) ([]byte, error) + func ModeFromCurve(curve elliptic.Curve) int + func ModeFromRSAMod(rsaMod int) (int, error) + func ModeGetCurve(mode int) (elliptic.Curve, error) + func ModeGetRSAMod(mode int) (int, error) + func ModeIsECDSAAlgo(mode int) bool + func ModeIsEncryptAlgo(mode int) bool + func ModeIsHashAlgo(mode int) bool + func ModeIsRSAAlgo(mode int) bool + func ModeIsSignatureAlgo(mode int) bool + func ParseECPrivateKey(der []byte) (*asym.ECDSAPrivateKey, error) + func ParsePKCS1PrivateKey(der []byte) (*rsa.PrivateKey, error) + func ParsePKCS1PublicKey(der []byte) (*rsa.PublicKey, error) + func ParsePKCS8PrivateKey(der []byte) (crypto.PrivateKey, error) + func ParsePKIXPublicKey(derBytes []byte) (rawPub []byte, mode int, err error) + func ParseSMPrivateKey(der []byte) (*gm.SM2PrivateKey, error) + func UseSm2Batch(reader io.Reader) crypto.FlagReader + type EncryptEngineMux struct + func (e *EncryptEngineMux) CreateDecKey(persistent bool, mode int) (index []byte, k crypto.DecKey, err error) + func (e *EncryptEngineMux) CreateSignKey(persistent bool, mode int) (index []byte, k crypto.SignKey, err error) + func (e *EncryptEngineMux) GetDecKey(key []byte, mode int) (crypto.DecKey, error) + func (e *EncryptEngineMux) GetEncKey(key []byte, mode int) (crypto.EncKey, error) + func (e *EncryptEngineMux) GetHash(mode int) (crypto.Hasher, error) + func (e *EncryptEngineMux) GetLevel() ([]int, uint8) + func (e *EncryptEngineMux) GetSecretKey(mode int, pwd, key []byte) (crypto.SecretKey, error) + func (e *EncryptEngineMux) GetSignKey(key []byte, mode int) (crypto.SignKey, error) + func (e *EncryptEngineMux) GetVerifyKey(key []byte, mode int) (crypto.VerifyKey, error) + func (e *EncryptEngineMux) ImportDecKey(key []byte, mode int) (index []byte, err error) + func (e *EncryptEngineMux) ImportSignKey(key []byte, mode int) (index []byte, err error) + func (e *EncryptEngineMux) Rander() (io.Reader, error) + func (e *EncryptEngineMux) String() string + type Function uint32 + const CreateDecKey + const CreateSign + const Crypt + const DecKeyGet + const DecKeyImport + const EncKey + const FunctionMax + const Hash + const Random + const SignGet + const SignImport + const Verify + func (f Function) String() string + type MockSecretKey struct + func (s *MockSecretKey) Decrypt(src []byte) []byte + func (s *MockSecretKey) Destroy() + func (s *MockSecretKey) Encrypt(src []byte, reader io.Reader) []byte + type PrivateKey struct + PrivKey crypto.Signer + func (p *PrivateKey) Decrypt(data []byte) ([]byte, error) + func (p *PrivateKey) Destroy() + func (p *PrivateKey) Sign(msg []byte, hasher hash.Hash, rand io.Reader) ([]byte, error) + type PublicKey struct + Key crypto.Verifier + Mode int + func (p *PublicKey) Bytes() (ret []byte) + func (p *PublicKey) Encrypt(data []byte, reader io.Reader) ([]byte, error) + func (p *PublicKey) GetKeyInfo() int + func (p *PublicKey) Verify(msg []byte, hasher hash.Hash, sig []byte) bool + type PublicKeyAlgorithm int + const ECDSA + const RSA + const SM2 + const UnknownPublicKeyAlgorithm + func GetPublicKeyAlgorithmFromAlgorithmIdentifier(algo pkix.AlgorithmIdentifier) PublicKeyAlgorithm + func (algo PublicKeyAlgorithm) String() string + type SecretKey struct + func (s *SecretKey) Decrypt(src []byte) []byte + func (s *SecretKey) Destroy() + func (s *SecretKey) Encrypt(src []byte, reader io.Reader) []byte