Documentation
¶
Overview ¶
Copyright (C) 2018 NuCypher
This file is part of goUmbral.
goUmbral is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
goUmbral is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with goUmbral. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2018 NuCypher ¶
This file is part of goUmbral.
goUmbral is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
goUmbral is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with goUmbral. If not, see <https://www.gnu.org/licenses/>.
Copyright (C) 2018 NuCypher ¶
This file is part of goUmbral.
goUmbral is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
goUmbral is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with goUmbral. If not, see <https://www.gnu.org/licenses/>.
Index ¶
- func ExpectedBytesLength(curve *openssl.Curve)
- func PointLength(curve *openssl.Curve, isCompressed bool) uint
- type ModBigNum
- func BytesToModBN(data []byte, curve *openssl.Curve) (*ModBigNum, error)
- func GenRandModBN(curve *openssl.Curve) (*ModBigNum, error)
- func HashToModBN(bytes []byte, params *UmbralParameters) (*ModBigNum, error)
- func IntToModBN(num int, curve *openssl.Curve) (*ModBigNum, error)
- func NewModBigNum(cNum openssl.BigNum, curve *openssl.Curve) (*ModBigNum, error)
- func (z *ModBigNum) Add(x, y *ModBigNum) error
- func (m *ModBigNum) Bytes() ([]byte, error)
- func (m ModBigNum) Compare(other *ModBigNum) int
- func (m *ModBigNum) Copy() (*ModBigNum, error)
- func (z *ModBigNum) Div(x, y *ModBigNum) error
- func (m *ModBigNum) Equals(other *ModBigNum) bool
- func (m *ModBigNum) Free()
- func (z *ModBigNum) Invert(x *ModBigNum) error
- func (z *ModBigNum) Mod(x, y *ModBigNum) error
- func (z *ModBigNum) Mul(x, y *ModBigNum) error
- func (z *ModBigNum) Neg(x *ModBigNum) error
- func (z *ModBigNum) Pow(x, y *ModBigNum) error
- func (z *ModBigNum) Sub(x, y *ModBigNum) error
- type Point
- func AffineToPoint(affineX, affineY *big.Int, curve *openssl.Curve) (*Point, error)
- func BytesToPoint(data []byte, curve *openssl.Curve) (*Point, error)
- func GenRandPoint(curve *openssl.Curve) (*Point, error)
- func GetGeneratorFromCurve(curve *openssl.Curve) *Point
- func NewPoint(point openssl.ECPoint, curve *openssl.Curve) (*Point, error)
- func UnsafeHashToPoint(data []byte, params *UmbralParameters, label []byte) (*Point, error)
- func (z *Point) Add(x, y *Point) error
- func (m *Point) Copy() (*Point, error)
- func (m *Point) Equals(other *Point) (bool, error)
- func (m *Point) Free()
- func (z *Point) Invert(x *Point) error
- func (z *Point) Mul(x *Point, y *ModBigNum) error
- func (z *Point) Sub(x, y *Point) error
- func (m Point) ToAffine() (*big.Int, *big.Int, error)
- func (m Point) ToBytes(isCompressed bool) ([]byte, error)
- type UmbralParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectedBytesLength ¶
Types ¶
type ModBigNum ¶
func BytesToModBN ¶
Returns the ModBigNum associated with the bytes-converted bignum provided by the data argument.
func GenRandModBN ¶
Returns a ModBigNum with a cryptographically secure OpenSSL BIGNUM based on the given curve.
func HashToModBN ¶
func HashToModBN(bytes []byte, params *UmbralParameters) (*ModBigNum, error)
Returns a ModBigNum based on provided data hashed by blake2b.
func NewModBigNum ¶
func (*ModBigNum) Add ¶
ModBigNum.Add() will perform (x + y) modulo the order of the curve of x and y. It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Add will return the error if one occurred, and nil otherwise.
func (*ModBigNum) Div ¶
ModBigNum.Div() will perform (x / y) modulo the order of the curve of x and y. It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Div will return the error if one occurred, and nil otherwise.
func (*ModBigNum) Invert ¶
ModBigNum.Invert() computes (x*z)%m==1 where m is the order of the curve of x and z. It will then set z to the result of that operation.
x and z must use the same curve and must be initialized.
Invert will return the error if one occurred, and nil otherwise.
func (*ModBigNum) Mod ¶
ModBigNum.Mod() will perform (x % y). It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Mod will return the error, and nil otherwise.
func (*ModBigNum) Mul ¶
ModBigNum.Mul() will perform (x * y) modulo the order of the curve of x and y. It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Mul will return the error if one occurred, and nil otherwise.
func (*ModBigNum) Neg ¶
ModBigNum.Neg() computes the modular opposite (i. e., additive inverse) of x. It will then set z to the result of that operation.
x and z must use the same curve and must be initialized.
Neg will return the error if one occurred, and nil otherwise.
func (*ModBigNum) Pow ¶
ModBigNum.Pow() will perform (x^y) modulo the order of the curve of x and y. It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Pow will return the error if one occurred, and nil otherwise.
type Point ¶
func AffineToPoint ¶
Returns a Point object from the given affine coordinates.
func GenRandPoint ¶
Returns a Point struct with a cryptographically secure EC_POINT based on the provided curve.
This operation isn't safe unless you know the discrete log of the generated Point.
func GetGeneratorFromCurve ¶
func NewPoint ¶
Generate a new Point struct based on the arguments provided.
If point is nil then GetNewPoint will generate a new opensslraphically secure ECPoint and check for errors before returning the new Point.
if point is nil AND the curve group is also nil then GetNewPoint will fail and return the error.
func UnsafeHashToPoint ¶
func UnsafeHashToPoint(data []byte, params *UmbralParameters, label []byte) (*Point, error)
WARNING: Do not use when the input data is secret, as this implementation is not in constant time, and hence, it is not safe with respect to timing attacks. TODO: Check how to uniformly generate ycoords. Currently, it only outputs points where ycoord is even (i.e., starting with 0x02 in compressed notation)
func (*Point) Add ¶
Point.Add() will perform (x + y). It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Add will return the error if one occurred, and nil otherwise.
func (*Point) Invert ¶
Point.Invert() will find the inverse of x. It will then set z to the result of that operation.
x must be initialized.
Invert will return the error if one occurred, and nil otherwise.
func (*Point) Mul ¶
Point.Mul() will perform (x * y). It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Mul will return the error if one occurred, and nil otherwise.
func (*Point) Sub ¶
Point.Sub() will perform (x - y). It will then set z to the result of that operation.
x, y, and z must use the same curve and must be initialized.
Sub will return the error if one occurred, and nil otherwise.
type UmbralParameters ¶
func NewUmbralParameters ¶
func NewUmbralParameters(curve *openssl.Curve) (*UmbralParameters, error)
func (*UmbralParameters) Equals ¶
func (m *UmbralParameters) Equals(other *UmbralParameters) bool