oprf

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package oprf implements the Elliptic Curve Oblivious Pseudorandom Function (EC-OPRF) from https://tools.ietf.org/html/draft-irtf-cfrg-voprf.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Identifier
	// contains filtered or unexported fields
}

Client implements the OPRF client and holds its state.

func (*Client) Blind

func (c *Client) Blind(input []byte, blind *group.Scalar) *group.Element

TODO: Blind存储input(password)和c.blind, 输出盲化值 Blind masks the input.

func (*Client) Finalize

func (c *Client) Finalize(evaluation *group.Element) []byte

Finalize terminates the OPRF by unblinding the evaluation and hashing the transcript.

type Identifier

type Identifier string

Identifier of the OPRF compatible cipher suite to be used.

const (
	// Ristretto255Sha512 is the OPRF cipher suite of the Ristretto255 group and SHA-512.
	Ristretto255Sha512 Identifier = "ristretto255-SHA512"

	// P256Sha256 is the OPRF cipher suite of the NIST P-256 group and SHA-256.
	P256Sha256 Identifier = "P256-SHA256"

	// P384Sha384 is the OPRF cipher suite of the NIST P-384 group and SHA-384.
	P384Sha384 Identifier = "P384-SHA384"

	// P521Sha512 is the OPRF cipher suite of the NIST P-512 group and SHA-512.
	P521Sha512 Identifier = "P521-SHA512"
)

func IDFromGroup

func IDFromGroup(g group.Group) Identifier

IDFromGroup returns the OPRF identifier corresponding to the input group.

func (Identifier) Available

func (i Identifier) Available() bool

Available returns whether the Identifier has been registered of not.

func (Identifier) Client

func (i Identifier) Client() *Client

TODO: oprf.Client() Client returns an OPRF client.

func (Identifier) DeriveKey

func (i Identifier) DeriveKey(seed, info []byte) *group.Scalar

DeriveKey returns a scalar mapped from the input.

func (Identifier) Evaluate

func (i Identifier) Evaluate(privateKey *group.Scalar, blindedElement *group.Element) *group.Element

Evaluate evaluates the blinded input with the given key.

func (Identifier) Group

func (i Identifier) Group() group.Group

Group returns the Group identifier for the cipher suite.

func (Identifier) Server

func (i Identifier) Server() *Server

New: add Server

type Server

type Server struct {
	Identifier
	// contains filtered or unexported fields
}

New: add oprf Server

func (*Server) Blind

func (s *Server) Blind(blindedElement *group.Element) *group.Element

New: add server blind func

func (*Server) ServiceLogin

func (s *Server) ServiceLogin(a1, a2, tau1, tau2 *group.Element, client *http.Client) *group.Element

func (*Server) ServiceReg

func (s *Server) ServiceReg(a1 *group.Element, a2 *group.Element, client *http.Client) *group.Element

func (*Server) UnBlind

func (s *Server) UnBlind(blindedElement *group.Element) *group.Element

New: add server unblind func

Jump to

Keyboard shortcuts

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