crypto

package
Version: v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package crypto provides the crypthographic algorithm used in the HAP protocol.

Index

Constants

View Source
const (
	// PacketLengthMax is the max length of encrypted packets
	PacketLengthMax = 0x400
)

Variables

This section is empty.

Functions

func ED25519GenerateKey

func ED25519GenerateKey(str string) ([]byte, []byte, error)

ED25519GenerateKey return a public and private ED25519 key pair from a string.

func ED25519Signature

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

ED25519Signature returns the ED25519 signature of data using the key.

func ValidateED25519Signature

func ValidateED25519Signature(key, data, signature []byte) bool

ValidateED25519Signature return true when the ED25519 signature is a valid signature of the data based on the key, otherwise false.

Types

type Cryptographer

type Cryptographer interface {
	Encrypter
	Decrypter
}

A Cryptographer is a De- and Encrypter.

func NewSecureClientSessionFromSharedKey

func NewSecureClientSessionFromSharedKey(sharedKey [32]byte) (Cryptographer, error)

NewSecureClientSessionFromSharedKey returns a session from a shared secret key to simulate a HomeKit client. This is currently only used for testing.

func NewSecureSessionFromSharedKey

func NewSecureSessionFromSharedKey(sharedKey [32]byte) (Cryptographer, error)

NewSecureSessionFromSharedKey returns a session from a shared private key.

type Decrypter

type Decrypter interface {
	Decrypt(r io.Reader) (io.Reader, error)
}

Decrypter decrypts bytes.

type Encrypter

type Encrypter interface {
	Encrypt(r io.Reader) (io.Reader, error)
}

Encrypter encrypts bytes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL