crypto

package
v2.21.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package crypto provides common crypto libraries for V2Ray.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAesDecryptionStream

func NewAesDecryptionStream(key []byte, iv []byte) cipher.Stream

NewAesDecryptionStream creates a new AES encryption stream based on given key and IV. Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.

func NewAesEncryptionStream

func NewAesEncryptionStream(key []byte, iv []byte) cipher.Stream

NewAesEncryptionStream creates a new AES description stream based on given key and IV. Caller must ensure the length of key and IV is either 16, 24 or 32 bytes.

func NewChaCha20Stream added in v1.9.1

func NewChaCha20Stream(key []byte, iv []byte) cipher.Stream

NewChaCha20Stream creates a new Chacha20 encryption/descryption stream based on give key and IV. Caller must ensure the length of key is 32 bytes, and length of IV is either 8 or 12 bytes.

Types

type AEADAuthenticator

type AEADAuthenticator struct {
	cipher.AEAD
	NonceGenerator          BytesGenerator
	AdditionalDataGenerator BytesGenerator
}

func (*AEADAuthenticator) Open

func (v *AEADAuthenticator) Open(dst, cipherText []byte) ([]byte, error)

func (*AEADAuthenticator) Seal

func (v *AEADAuthenticator) Seal(dst, plainText []byte) ([]byte, error)

type AuthenticationReader

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

func NewAuthenticationReader

func NewAuthenticationReader(auth Authenticator, reader io.Reader, sizeMask Uint16Generator) *AuthenticationReader

func (*AuthenticationReader) Read

func (v *AuthenticationReader) Read(b []byte) (int, error)

type AuthenticationWriter

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

func NewAuthenticationWriter

func NewAuthenticationWriter(auth Authenticator, writer io.Writer, sizeMask Uint16Generator) *AuthenticationWriter

func (*AuthenticationWriter) Write

func (v *AuthenticationWriter) Write(b []byte) (int, error)

type Authenticator

type Authenticator interface {
	NonceSize() int
	Overhead() int
	Open(dst, cipherText []byte) ([]byte, error)
	Seal(dst, plainText []byte) ([]byte, error)
}

type BytesGenerator

type BytesGenerator interface {
	Next() []byte
}

type CryptionReader added in v1.11.1

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

func NewCryptionReader

func NewCryptionReader(stream cipher.Stream, reader io.Reader) *CryptionReader

func (*CryptionReader) Read added in v1.11.1

func (v *CryptionReader) Read(data []byte) (int, error)

type CryptionWriter added in v1.11.1

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

func NewCryptionWriter

func NewCryptionWriter(stream cipher.Stream, writer io.Writer) *CryptionWriter

NewCryptionWriter creates a new CryptionWriter.

func (*CryptionWriter) Write added in v1.11.1

func (v *CryptionWriter) Write(data []byte) (int, error)

Write implements io.Writer.Write().

type NoOpBytesGenerator

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

func (NoOpBytesGenerator) Next

func (v NoOpBytesGenerator) Next() []byte

type ShakeUint16Generator

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

func NewShakeUint16Generator

func NewShakeUint16Generator(nonce []byte) *ShakeUint16Generator

func (*ShakeUint16Generator) Next

func (g *ShakeUint16Generator) Next() uint16

type StaticBytesGenerator

type StaticBytesGenerator struct {
	Content []byte
}

func (StaticBytesGenerator) Next

func (v StaticBytesGenerator) Next() []byte

type StaticUint16Generator

type StaticUint16Generator uint16

func (StaticUint16Generator) Next

func (g StaticUint16Generator) Next() uint16

type Uint16Generator

type Uint16Generator interface {
	Next() uint16
}

Directories

Path Synopsis
GENERATED CODE.
GENERATED CODE.

Jump to

Keyboard shortcuts

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