crypto

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package crypto provides SRT cryptography

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKey = errors.New("crypto: invalid key for encryption. Must be even, odd, or both")

ErrInvalidKey is returned when the packet encryption is invalid

View Source
var ErrInvalidWrap = errors.New("crypto: the un/wrapped key has the wrong length")

ErrInvalidWrap is returned when the packet encryption indicates a different length of the wrapped key

Functions

This section is empty.

Types

type Crypto

type Crypto interface {
	// Generate generates an even or odd SEK.
	GenerateSEK(key packet.PacketEncryption) error

	// UnmarshalMK unwraps the key with the passphrase in a Key Material Extension Message. If the passphrase
	// is wrong an error is returned.
	UnmarshalKM(km *packet.CIFKeyMaterialExtension, passphrase string) error

	// MarshalKM wraps the key with the passphrase and the odd/even SEK for a Key Material Extension Message.
	MarshalKM(km *packet.CIFKeyMaterialExtension, passphrase string, key packet.PacketEncryption) error

	// EncryptOrDecryptPayload encrypts or decrypts the data of a packet with an even or odd SEK and
	// the sequence number.
	EncryptOrDecryptPayload(data []byte, key packet.PacketEncryption, packetSequenceNumber uint32) error
}

Crypto implements the SRT data encryption and decryption.

func New

func New(keyLength int) (Crypto, error)

New returns a new SRT data encryption and decryption for the keyLength. On failure error is non-nil.

Jump to

Keyboard shortcuts

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