pythia

package
v5.0.0-...-eb495f6 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: BSD-3-Clause Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BN_SIZE = int(C.PYTHIA_BN_BUF_SIZE)
	G1_SIZE = int(C.PYTHIA_G1_BUF_SIZE)
	G2_SIZE = int(C.PYTHIA_G2_BUF_SIZE)
	GT_SIZE = int(C.PYTHIA_GT_BUF_SIZE)
)

Functions

This section is empty.

Types

type Buf

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

Buf is needed to pass memory from Go to C and back

func NewBuf

func NewBuf(size int) *Buf

NewBuf allocates memory block of predefined size

func NewBufWithData

func NewBufWithData(data []byte) *Buf

NewBufWithData allocates new buffer and sets it memory to data

func (*Buf) Close

func (b *Buf) Close()

Close frees memory allocated by Buf in C code

func (*Buf) GetData

func (b *Buf) GetData() []byte

GetData returns as many bytes as were written to buf by C code

type Error

type Error struct {
	Code    int
	Message string
}

func NewPythiaError

func NewPythiaError(code int, message string) Error

func (Error) Error

func (e Error) Error() string

type Pythia

type Pythia struct {
}

func New

func New() *Pythia

func (*Pythia) Blind

func (p *Pythia) Blind(password []byte) (blindedPassword, blindingSecret []byte, err error)

Blind turns password into a pseudo-random string.

func (*Pythia) ComputeTransformationKeypair

func (p *Pythia) ComputeTransformationKeypair(transformationKeyId, pythiaSecret, pythiaScopeSecret []byte) (privateKey, publicKey []byte, err error)

*

  • ComputeTransformationKeypair Computes transformation private and public key. *
  • @param [in] transformation_key_id - ensemble key ID used to enclose operations in subsets.
  • @param [in] pythia_secret - global common for all secret random Key.
  • @param [in] pythia_scope_secret - ensemble secret generated and versioned transparently.
  • @param [out] transformation_private_key - BN transformation_private_key Pythia's private key
  • which was generated using pythia_secret and pythia_scope_secret.
  • This key is used to emit proof tokens (proof_value_c, proof_value_u).
  • @param [out] transformation_public_key *
  • @return 0 if succeeded, -1 otherwise

func (*Pythia) Deblind

func (p *Pythia) Deblind(transformedPassword []byte, blindingSecret []byte) (deblindedPassword []byte, err error)

Deblind unmasks value y with previously returned secret from Blind()

func (*Pythia) GenerateKeypair

func (p *Pythia) GenerateKeypair(keypairType virgil_crypto_go.KeyType, seed []byte) (keypair interface {
	PublicKey() interface {
		IsPublic() bool
		Identifier() []byte
	}

	PrivateKey() interface {
		IsPrivate() bool
		Identifier() []byte
	}
}, err error)

func (*Pythia) GetPasswordUpdateToken

func (p *Pythia) GetPasswordUpdateToken(previousTransformationPrivateKey, newTransformationPrivateKey []byte) (passwordUpdateToken []byte, err error)

GetPasswordUpdateToken generates token that can update protected passwords from the combination of (old) w1, msk1, ssk1 to (new) w2, msk2, ssk2

func (*Pythia) Prove

func (p *Pythia) Prove(transformedPassword, blindedPassword, transformedTweak, transformationPrivateKey, transformationPublicKey []byte) (proofValueC, proofValueU []byte, err error)

Prove proves that server possesses secret values that are used to protect password

func (*Pythia) Transform

func (p *Pythia) Transform(blindedPassword, tweak, transformationPrivateKey []byte) (transformedPassword, transformedTweak []byte, err error)

Transform turns blinded password into cryptographically strong value. *

  • @brief Transforms blinded password using the private key, generated from pythia_secret + pythia_scope_secret. *
  • @param [in] blinded_password - G1 password obfuscated into a pseudo-random string.
  • @param [in] tweak - some random value used to transform a password.
  • @param [in] transformation_private_key - BN transformation private key.
  • @param [out] transformed_password - GT blinded password, protected using server secret
  • (transformation private key + tweak).
  • @param [out] transformed_tweak - G2 tweak value turned into an elliptic curve point.
  • This value is used by Prove() operation. *
  • @return 0 if succeeded, -1 otherwise

func (*Pythia) UpdateDeblindedWithToken

func (p *Pythia) UpdateDeblindedWithToken(deblindedPassword, passwordUpdateToken []byte) (updatedDeblindedPassword []byte, err error)

UpdateDeblindedWithToken updates previously stored deblinded protected password with token. After this call, Transform() called with new arguments will return corresponding values

func (*Pythia) Verify

func (p *Pythia) Verify(transformedPassword, blindedPassword, tweak, transformationPublicKey, proofValueC, proofValueU []byte) (err error)

Verify The protocol enables a client to verify that the output of Transform() is correct, assuming the client has previously stored p. The server accompanies the output y of the Transform() with a zero-knowledge proof (c, u) of correctness

Jump to

Keyboard shortcuts

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