d2d

package
v0.0.0-...-cf5a519 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	D2DSalt = sha256.Sum256([]byte("D2D"))

	SECURE_GCM_VERSION = int32(1)
	DIGEST_LENGTH      = 20
)
View Source
var (
	HMAC_SHA256       = SigType{pb.SigScheme_HMAC_SHA256, "HmacSHA256", false}
	ECDSA_P256_SHA256 = SigType{pb.SigScheme_ECDSA_P256_SHA256, "SHA256withECDSA", true}
	RSA2048_SHA256    = SigType{pb.SigScheme_RSA2048_SHA256, "SHA256withRSA", true}
)
View Source
var (
	NONE        = EncType{pb.EncScheme_NONE, "InvalidDoNotUseForJCA", 0}
	AES_256_CBC = EncType{pb.EncScheme_AES_256_CBC, "AES/CBC/PKCS5Padding", 16}
)

Functions

This section is empty.

Types

type AbstractD2DConnectionContext

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

func (*AbstractD2DConnectionContext) DecodeMessageFromPeer

func (a *AbstractD2DConnectionContext) DecodeMessageFromPeer(d2cc D2DConnectionContext, message []byte) ([]byte, error)

func (*AbstractD2DConnectionContext) EncodeMessageToPeer

func (d2dConnectionContext *AbstractD2DConnectionContext) EncodeMessageToPeer(d2dcc D2DConnectionContext, payload []byte) []byte

func (*AbstractD2DConnectionContext) GetProtocolVersion

func (d2dConnectionContext *AbstractD2DConnectionContext) GetProtocolVersion() int32

type D2DConnectionContext

type D2DConnectionContext interface {
	SaveSession() []byte //abstract
	// contains filtered or unexported methods
}

func FromSavedSession

func FromSavedSession(savedSessionInfo []byte) (D2DConnectionContext, error)

func NewD2DConnectionContextV1

func NewD2DConnectionContextV1(encodeKey []byte, decodeKey []byte, initalEncodeSquenceNumber int32, initalDecodeSquenceNumber int32) D2DConnectionContext

type D2DConnectionContextV1

type D2DConnectionContextV1 struct {
	AbstractD2DConnectionContext
	// contains filtered or unexported fields
}

func (*D2DConnectionContextV1) SaveSession

func (d *D2DConnectionContextV1) SaveSession() []byte

type EncType

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

type Payload

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

func NewPayload

func NewPayload(payloadType PayloadType, message []byte) *Payload

type PayloadType

type PayloadType int
const (
	ENROLLMENT PayloadType = iota
	TICKLE
	TX_REQUEST
	TX_REPLY
	TX_SYNC_REQUEST
	TX_SYNC_RESPONSE
	TX_PING
	DEVICE_INFO_UPDATE
	TX_CANCEL_REQUEST
	LOGIN_NOTIFICATION
	PROXIMITYAUTH_PAIRING
	GCMV1_IDENTITY_ASSERTION
	DEVICE_TO_DEVICE_RESPONDER_HELLO_PAYLOAD
	DEVICE_TO_DEVICE_MESSAGE
	DEVICE_PROXIMITY_CALLBACK
	UNLOCK_KEY_SIGNED_CHALLENGE
)

type SecureMessageBuilder

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

func NewSecureMessageBuilder

func NewSecureMessageBuilder() *SecureMessageBuilder

func (*SecureMessageBuilder) BuildSignCryptedMessage

func (smb *SecureMessageBuilder) BuildSignCryptedMessage(signingKey []byte, sigType SigType, encryptionKey []byte, encType EncType, body []byte) (*pb.SecureMessage, error)

func (*SecureMessageBuilder) BuildSignedClearTextMessage

func (smb *SecureMessageBuilder) BuildSignedClearTextMessage(signingKey []byte, sigType SigType, body []byte) (*pb.SecureMessage, error)

func (*SecureMessageBuilder) Reset

func (smb *SecureMessageBuilder) Reset()

func (*SecureMessageBuilder) SetAssociatedData

func (smb *SecureMessageBuilder) SetAssociatedData(associatedData []byte)

func (*SecureMessageBuilder) SetDecryptionKeyId

func (smb *SecureMessageBuilder) SetDecryptionKeyId(decryptionKeyId []byte)

func (*SecureMessageBuilder) SetPublicMetaData

func (smb *SecureMessageBuilder) SetPublicMetaData(metadata []byte)

func (*SecureMessageBuilder) SetVerificationKeyId

func (smb *SecureMessageBuilder) SetVerificationKeyId(verificationKeyId []byte)

type SigType

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

func (*SigType) GetJcaName

func (s *SigType) GetJcaName() string

func (*SigType) GetSigScheme

func (s *SigType) GetSigScheme() pb.SigScheme

func (*SigType) IsPublicScheme

func (s *SigType) IsPublicScheme() bool

Jump to

Keyboard shortcuts

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