cryptoservices

package
v3.25.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package cryptoservices implements services for LoRaWAN cryptograhpy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application interface {
	DeriveAppSKey(
		ctx context.Context,
		dev *ttnpb.EndDevice,
		version ttnpb.MACVersion,
		jn types.JoinNonce,
		dn types.DevNonce,
		nid types.NetID,
	) (types.AES128Key, error)
	// GetAppKey returns the AppKey of the given end device.
	// If the implementation does not expose root keys, this method returns nil, nil.
	GetAppKey(ctx context.Context, dev *ttnpb.EndDevice) (*types.AES128Key, error)
}

Application performs application layer cryptographic operations.

func NewApplicationRPCClient

func NewApplicationRPCClient(cc *grpc.ClientConn, keyVault crypto.KeyService, callOpts ...grpc.CallOption) Application

NewApplicationRPCClient returns an application service which uses a gRPC service on the given connection.

type GetKeysFunc added in v3.23.0

type GetKeysFunc func(ctx context.Context, dev *ttnpb.EndDevice) (nwkKey, appKey *types.AES128Key, err error)

GetKeysFunc returns the root keys for the given end device.

type Network

type Network interface {
	JoinRequestMIC(ctx context.Context, dev *ttnpb.EndDevice, version ttnpb.MACVersion, payload []byte) ([4]byte, error)
	JoinAcceptMIC(
		ctx context.Context,
		dev *ttnpb.EndDevice,
		version ttnpb.MACVersion,
		joinReqType byte,
		dn types.DevNonce,
		payload []byte,
	) ([4]byte, error)
	EncryptJoinAccept(ctx context.Context, dev *ttnpb.EndDevice, version ttnpb.MACVersion, payload []byte) ([]byte, error)
	EncryptRejoinAccept(
		ctx context.Context, dev *ttnpb.EndDevice, version ttnpb.MACVersion, payload []byte,
	) ([]byte, error)
	DeriveNwkSKeys(
		ctx context.Context,
		dev *ttnpb.EndDevice,
		version ttnpb.MACVersion,
		jn types.JoinNonce,
		dn types.DevNonce,
		nid types.NetID,
	) (NwkSKeys, error)
	// GetNwkKey returns the NwkKey of the given end device.
	// If the implementation does not expose root keys, this method returns nil, nil.
	GetNwkKey(ctx context.Context, dev *ttnpb.EndDevice) (*types.AES128Key, error)
}

Network performs network layer cryptographic operations.

func NewNetworkRPCClient

func NewNetworkRPCClient(cc *grpc.ClientConn, keyVault crypto.KeyService, callOpts ...grpc.CallOption) Network

NewNetworkRPCClient returns a network service which uses a gRPC service on the given connection.

type NetworkApplication

type NetworkApplication interface {
	Network
	Application
}

NetworkApplication is an interface that combines Network and Application.

func NewMemory

func NewMemory(nwkKey, appKey *types.AES128Key) NetworkApplication

NewMemory returns a network and application service using the given fixed root keys, performing cryptograhpic operations in memory.

func NewPerDevice added in v3.23.0

func NewPerDevice(getKeys GetKeysFunc) NetworkApplication

NewPerDevice returns a network and application service using per-device root keys, performing cryptograhpic operations in memory.

type NwkSKeys

type NwkSKeys struct {
	FNwkSIntKey,
	SNwkSIntKey,
	NwkSEncKey types.AES128Key
}

NwkSKeys contains network session keys.

Jump to

Keyboard shortcuts

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