wincrypto

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AESBlockSize = 16
	AESIVSize    = 16
)

about AES block and IV.

View Source
const (
	RSAKeyUsageSIGN = 1
	RSAKeyUsageKEYX = 2
)

about RSA key usage.

Variables

View Source
var (
	ErrEmptyPlainData     = errors.New("empty aes plain data")
	ErrEmptyCipherData    = errors.New("empty aes cipher data")
	ErrInvalidCipherData  = errors.New("invalid aes cipher data")
	ErrInvalidPaddingSize = errors.New("invalid aes padding size")
)

errors about AESEncrypt and AESDecrypt.

Functions

func AESDecrypt

func AESDecrypt(data, key []byte) ([]byte, error)

AESDecrypt is used to decrypt data with CBC mode and PKCS#5 padding method.

func AESEncrypt

func AESEncrypt(data, key []byte) ([]byte, error)

AESEncrypt is used to encrypt data with CBC mode and PKCS#5 padding method.

func ExportRSAPrivateKeyBlob

func ExportRSAPrivateKeyBlob(key *rsa.PrivateKey, usage int) ([]byte, error)

ExportRSAPrivateKeyBlob is used to export rsa private key with PrivateKeyBlob.

func ExportRSAPublicKeyBlob

func ExportRSAPublicKeyBlob(key *rsa.PublicKey, usage int) ([]byte, error)

ExportRSAPublicKeyBlob is used to export rsa public key with PublicKeyBlob.

func ImportRSAPrivateKeyBlob

func ImportRSAPrivateKeyBlob(data []byte) (*rsa.PrivateKey, error)

ImportRSAPrivateKeyBlob is used to import rsa private key with PrivateKeyBlob.

func ImportRSAPublicKeyBlob

func ImportRSAPublicKeyBlob(data []byte) (*rsa.PublicKey, error)

ImportRSAPublicKeyBlob is used to import rsa public key with PublicKeyBlob.

func ParseRSAPrivateKey

func ParseRSAPrivateKey(der []byte) (*rsa.PrivateKey, error)

ParseRSAPrivateKey is used to load rsa private key from ASN.1 DER data.

func ParseRSAPrivateKeyPEM

func ParseRSAPrivateKeyPEM(data []byte) (*rsa.PrivateKey, error)

ParseRSAPrivateKeyPEM is used to load rsa private key from PEM block.

func ParseRSAPublicKey

func ParseRSAPublicKey(der []byte) (*rsa.PublicKey, error)

ParseRSAPublicKey is used to load rsa public key from ASN.1 DER data.

func ParseRSAPublicKeyPEM

func ParseRSAPublicKeyPEM(data []byte) (*rsa.PublicKey, error)

ParseRSAPublicKeyPEM is used to load rsa public key from PEM block.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL