security

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

This is a mirror of golang.org/x/crypto/internal/subtle.

go官方没有实现ecb加密模式

Index

Constants

View Source
const (
	DH_KEY_LENGTH int = 64
	/* 低7位用于保存分组加密算法中的工作模式 */
	WORK_MODE_MASK int = 0x007f
	ECB_MODE       int = 0x1
	CBC_MODE       int = 0x2
	CFB_MODE       int = 0x4
	OFB_MODE       int = 0x8
	/* 高位保存加密算法 */
	ALGO_MASK int = 0xff80
	DES       int = 0x0080
	DES3      int = 0x0100
	AES128    int = 0x0200
	AES192    int = 0x0400
	AES256    int = 0x0800
	RC4       int = 0x1000
	MD5       int = 0x1100

	// 用户名密码加密算法
	DES_CFB int = 132
	// 消息加密摘要长度
	MD5_DIGEST_SIZE int = 16

	MIN_EXTERNAL_CIPHER_ID int = 5000
)

Variables

This section is empty.

Functions

func AnyOverlap

func AnyOverlap(x, y []byte) bool

AnyOverlap reports whether x and y share memory at any (not necessarily corresponding) index. The memory beyond the slice length is ignored.

func Bn2Bytes

func Bn2Bytes(bn *big.Int, bnLen int) []byte

func ComputeSessionKey

func ComputeSessionKey(clientPrivKey *DhKey, serverPubKey []byte) []byte

func InexactOverlap

func InexactOverlap(x, y []byte) bool

InexactOverlap reports whether x and y share memory at any non-corresponding index. The memory beyond the slice length is ignored. Note that x and y can have different lengths and still not have any inexact overlap.

InexactOverlap can be used to implement the requirements of the crypto/cipher AEAD, Block, BlockMode and Stream interfaces.

func NewECBDecrypter

func NewECBDecrypter(b cipher.Block) cipher.BlockMode

func NewECBEncrypter

func NewECBEncrypter(b cipher.Block) cipher.BlockMode

func NewTLSFromTCP

func NewTLSFromTCP(conn *net.TCPConn, sslCertPath string, sslKeyPath string, user string) (*tls.Conn, error)

Types

type Cipher

type Cipher interface {
	Encrypt(plaintext []byte, genDigest bool) []byte
	Decrypt(ciphertext []byte, checkDigest bool) ([]byte, error)
}

type DhKey

type DhKey struct {
	// contains filtered or unexported fields
}

func NewClientKeyPair

func NewClientKeyPair() (key *DhKey, err error)

func (*DhKey) GetX

func (dk *DhKey) GetX() *big.Int

func (*DhKey) GetY

func (dk *DhKey) GetY() *big.Int

func (*DhKey) GetYBytes

func (dk *DhKey) GetYBytes() []byte

func (*DhKey) GetYString

func (dk *DhKey) GetYString() string

func (*DhKey) IsPrivateKey

func (dk *DhKey) IsPrivateKey() bool

type SymmCipher

type SymmCipher struct {
	// contains filtered or unexported fields
}

func NewSymmCipher

func NewSymmCipher(algorithmID int, key []byte) (SymmCipher, error)

func (SymmCipher) Decrypt

func (sc SymmCipher) Decrypt(ciphertext []byte, checkDigest bool) ([]byte, error)

func (SymmCipher) Encrypt

func (sc SymmCipher) Encrypt(plaintext []byte, genDigest bool) []byte

type ThirdPartCipher

type ThirdPartCipher struct {
	// contains filtered or unexported fields
}

func NewThirdPartCipher

func NewThirdPartCipher(encryptType int, key []byte, cipherPath string, hashType int) (ThirdPartCipher, error)

func (ThirdPartCipher) Decrypt

func (tpc ThirdPartCipher) Decrypt(ciphertext []byte, checkDigest bool) ([]byte, error)

func (ThirdPartCipher) Encrypt

func (tpc ThirdPartCipher) Encrypt(plaintext []byte, genDigest bool) []byte

Jump to

Keyboard shortcuts

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