ffs

package
v0.0.0-...-54da8ec Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateX

func CalculateX(s int8, r, N *big.Int) (X *big.Int)

func GetSign

func GetSign() int8

Types

type AuthenticationRequest

type AuthenticationRequest struct {
	VerifyVals BigIntArray
	X          *big.Int
	N          *big.Int
}

func NewAuthenticationRequest

func NewAuthenticationRequest(verifyVals BigIntArray, x, n *big.Int) AuthenticationRequest

type AuthenticationResponse

type AuthenticationResponse struct {
	ChosenSecrets []int8
}

func NewAuthenticationResponse

func NewAuthenticationResponse(chosenSecrets []int8) AuthenticationResponse

type AuthenticationVerifyRequest

type AuthenticationVerifyRequest struct {
	Y *big.Int
}

func NewAuthenticationVerifyRequest

func NewAuthenticationVerifyRequest(y *big.Int) AuthenticationVerifyRequest

type AuthenticationVerifyResponse

type AuthenticationVerifyResponse struct {
	IsAccessGranted bool
}

func NewAuthenticationVerifyResponse

func NewAuthenticationVerifyResponse(isAccessGranted bool) AuthenticationVerifyResponse

type BigIntArray

type BigIntArray []big.Int

func (BigIntArray) String

func (m BigIntArray) String() string

type FeigeFiatShamirInitiator

type FeigeFiatShamirInitiator struct {

	// N = p * q
	N *big.Int

	// Calculated for each authentication attempt
	// X = s * r² mod N
	X *big.Int

	// verification values: used for someone to verify that initiator has the secrets (are trasnmitted on a public channel)
	// vᵢ = sᵢ² mod N for 0 < i <= noSecretVals
	VerifyVals BigIntArray
	// contains filtered or unexported fields
}

func NewFeigeFiatShamirInitiator

func NewFeigeFiatShamirInitiator(noSecretBits, noSecretVals int) FeigeFiatShamirInitiator

Create new Feige-Fiat-Shamir Initiator. noSecretBits must be >= 5 noSecretVals must be >= 1

func (*FeigeFiatShamirInitiator) CalculateVerifyValues

func (ffsi *FeigeFiatShamirInitiator) CalculateVerifyValues(secretVals BigIntArray, n *big.Int) (verifyVals BigIntArray)

func (*FeigeFiatShamirInitiator) CreatePrimes

func (ffsi *FeigeFiatShamirInitiator) CreatePrimes() (p, q, N *big.Int)

Creates two different prime numbers p and q and return them along with their product N

func (*FeigeFiatShamirInitiator) GenerateSecretValues

func (ffsi *FeigeFiatShamirInitiator) GenerateSecretValues(noSecretVals int, N *big.Int) (secretVals BigIntArray)

func (*FeigeFiatShamirInitiator) InitiateAuthentication

func (ffsi *FeigeFiatShamirInitiator) InitiateAuthentication() AuthenticationRequest

send verification values, X and N to authentication responder (these are public and even when eavesdropped do not compromise security of protocol)

func (*FeigeFiatShamirInitiator) OnAuthenticationResponse

func (ffsi *FeigeFiatShamirInitiator) OnAuthenticationResponse(as []int8) AuthenticationVerifyRequest

func (*FeigeFiatShamirInitiator) OnAuthenticationVerifyResponse

func (ffsi *FeigeFiatShamirInitiator) OnAuthenticationVerifyResponse(isAccessGranted bool)

func (*FeigeFiatShamirInitiator) Prepare

func (ffsi *FeigeFiatShamirInitiator) Prepare()

func (*FeigeFiatShamirInitiator) PrintAuthenticationStep1Values

func (ffsi *FeigeFiatShamirInitiator) PrintAuthenticationStep1Values(publicOnly bool)

type FeigeFiatShamirResponder

type FeigeFiatShamirResponder struct {
	X             *big.Int
	ChosenSecrets []int8
	N             *big.Int
	// verification values: used for someone to verify that initiator has the secrets (are trasnmitted on a public channel)
	VerifyVals BigIntArray
}

func NewFeigeFiatShamirResponder

func NewFeigeFiatShamirResponder() FeigeFiatShamirResponder

Create new instance of FeigeFiatShamirResponder. This is the server instance authenticating clients on

func (*FeigeFiatShamirResponder) OnAuthenticateRequest

func (ffsr *FeigeFiatShamirResponder) OnAuthenticateRequest(verifyVals BigIntArray, X, N *big.Int) AuthenticationResponse

Called when a Feige-Fiat-Shamir Initiator wants to authenticate itself against a responder. The initiator will send k ∈ N verification values, an X value and N. The responder now needs to generate k elements aᵢ with 0 < i <= k where each one is randomly either a 0 or a 1.

func (*FeigeFiatShamirResponder) OnAuthenticationVerify

func (ffsr *FeigeFiatShamirResponder) OnAuthenticationVerify(y *big.Int) AuthenticationVerifyResponse

Decides wether authentication is successful or not. Authentication is successful if y² = +-X * (vᵢ)ᵃᵢ mod N is true. Otherwise authentication failed.

type InitAuthenticationWithServer

type InitAuthenticationWithServer struct {
	Server actor.PID
}

func NewInitAuthenticationWithServer

func NewInitAuthenticationWithServer(server actor.PID) InitAuthenticationWithServer

Jump to

Keyboard shortcuts

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