Documentation ¶
Overview ¶
Copyright 2018 ProximaX Limited. All rights reserved. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
Index ¶
- Constants
- Variables
- func BigInteger_ONE() *big.Int
- func BigInteger_ZERO() *big.Int
- func Ed25519Field_P() *big.Int
- func Ed25519Field_ZERO_LONG() []byte
- func Ed25519Field_ZERO_SHORT() []byte
- func HashesRipemd160(b []byte) ([]byte, error)
- func HashesSha3_256(b []byte) ([]byte, error)
- func HashesSha3_512(inputs ...[]byte) ([]byte, error)
- func IsConstantTimeByteEq(b, c int) int
- func XMul_YModInverseAndMod_P(x *big.Int, y *big.Int) *big.Int
- type AESEngine
- type BlockCipher
- type BufferedBlockCipher
- type CBCBlockCipher
- type Cipher
- type CipherParameters
- type CoordinateSystem
- type CryptoEngine
- type Curve
- type DsaSigner
- type Ed25519BlockCipher
- type Ed25519CryptoEngine
- func (ref *Ed25519CryptoEngine) CreateBlockCipher(senderKeyPair *KeyPair, recipientKeyPair *KeyPair) BlockCipher
- func (ref *Ed25519CryptoEngine) CreateDsaSigner(keyPair *KeyPair) DsaSigner
- func (ref *Ed25519CryptoEngine) CreateKeyAnalyzer() KeyAnalyzer
- func (ref *Ed25519CryptoEngine) CreateKeyGenerator() KeyGenerator
- func (ref *Ed25519CryptoEngine) GetCurve() Curve
- type Ed25519DsaSigner
- func (ref *Ed25519DsaSigner) IsCanonicalSignature(signature *Signature) bool
- func (ref *Ed25519DsaSigner) MakeSignatureCanonical(signature *Signature) (*Signature, error)
- func (ref *Ed25519DsaSigner) Sign(mess []byte) (*Signature, error)
- func (ref *Ed25519DsaSigner) Verify(mess []byte, signature *Signature) (res bool)
- type Ed25519EncodedFieldElement
- func (ref *Ed25519EncodedFieldElement) Decode() *Ed25519FieldElement
- func (ref *Ed25519EncodedFieldElement) Equals(ge *Ed25519EncodedFieldElement) bool
- func (ref *Ed25519EncodedFieldElement) IsNegative() bool
- func (ref *Ed25519EncodedFieldElement) IsNonZero() bool
- func (ref *Ed25519EncodedFieldElement) String() string
- type Ed25519EncodedGroupElement
- func (ref *Ed25519EncodedGroupElement) Decode() (*Ed25519GroupElement, error)
- func (ref *Ed25519EncodedGroupElement) Equals(ge *Ed25519EncodedGroupElement) bool
- func (ref *Ed25519EncodedGroupElement) GetAffineX() (*Ed25519FieldElement, error)
- func (ref *Ed25519EncodedGroupElement) GetAffineY() (*Ed25519FieldElement, error)
- func (ref *Ed25519EncodedGroupElement) String() string
- type Ed25519FieldElement
- func Ed25519FieldElementSqrt(u Ed25519FieldElement, v Ed25519FieldElement) Ed25519FieldElement
- func Ed25519Field_D() *Ed25519FieldElement
- func Ed25519Field_D_Times_TWO() *Ed25519FieldElement
- func Ed25519Field_ONE() *Ed25519FieldElement
- func Ed25519Field_TWO() *Ed25519FieldElement
- func Ed25519Field_ZERO() *Ed25519FieldElement
- func NewEd25519FieldElement(Raw []intRaw) (*Ed25519FieldElement, error)
- type Ed25519GroupElement
- func NewEd25519GroupElement(coordinateSystem CoordinateSystem, x *Ed25519FieldElement, ...) *Ed25519GroupElement
- func NewEd25519GroupElementAffine(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
- func NewEd25519GroupElementCached(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, ...) *Ed25519GroupElement
- func NewEd25519GroupElementP1XP1(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, ...) *Ed25519GroupElement
- func NewEd25519GroupElementP2(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
- func NewEd25519GroupElementP3(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, ...) *Ed25519GroupElement
- func NewEd25519GroupElementPrecomputed(x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
- func (ref *Ed25519GroupElement) Encode() (*Ed25519EncodedGroupElement, error)
- func (ref *Ed25519GroupElement) Equals(ge *Ed25519GroupElement) (res bool)
- func (ref *Ed25519GroupElement) GetCoordinateSystem() CoordinateSystem
- func (ref *Ed25519GroupElement) GetT() *Ed25519FieldElement
- func (ref *Ed25519GroupElement) GetX() *Ed25519FieldElement
- func (ref *Ed25519GroupElement) GetY() *Ed25519FieldElement
- func (ref *Ed25519GroupElement) GetZ() *Ed25519FieldElement
- func (ref *Ed25519GroupElement) IsPrecomputedForDoubleScalarMultiplication() bool
- func (ref *Ed25519GroupElement) PrecomputeForDoubleScalarMultiplication()
- func (ref *Ed25519GroupElement) PrecomputeForScalarMultiplication()
- func (ref *Ed25519GroupElement) SatisfiesCurveEquation() bool
- func (ref *Ed25519GroupElement) Select(pos int, b int) (*Ed25519GroupElement, error)
- func (ref *Ed25519GroupElement) String() string
- type Ed25519KeyAnalyzer
- type Ed25519KeyGenerator
- type KeyAnalyzer
- type KeyGenerator
- type KeyPair
- type KeyParameter
- type PKCS7Padding
- type PrivateKey
- type PublicKey
- type Signature
- type Signer
Constants ¶
const COMPRESSED_KEY_SIZE = 32
const Ed25519FieldI = "b0a00e4a271beec478e42fad0618432fa7d7fb3d99004d2b0bdfc14f8024832b"
Variables ¶
var A = &Ed25519FieldElement{[]intRaw{
486662, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}}
var CryptoEngines = cryptoEngines{ &Ed25519CryptoEngine{}, &Ed25519CryptoEngine{}, }
var Ed25519Curve = &ed25519Curve{}
var Ed25519Field = ed25519Field{ Ed25519Field_P(), *(Ed25519Field_ZERO()), *(Ed25519Field_ONE()), *(Ed25519Field_TWO()), *(Ed25519Field_D()), *(Ed25519Field_D_Times_TWO()), *((&Ed25519EncodedFieldElement{Ed25519Field_ZERO_SHORT(), utils.MustHexDecodeString(Ed25519FieldI)}).Decode()), }
var Ed25519Group = &ed25519Group{}
Ed25519Groupp
var MathUtils mathUtils
var SqrtM1 = &Ed25519FieldElement{[]intRaw{
-32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482,
}}
Functions ¶
func BigInteger_ONE ¶
func BigInteger_ZERO ¶
src/test/java/io/nem/core/crypto/ed25519/arithmetic/MathUtils.java
func Ed25519Field_ZERO_LONG ¶
func Ed25519Field_ZERO_LONG() []byte
func Ed25519Field_ZERO_SHORT ¶
func Ed25519Field_ZERO_SHORT() []byte
func HashesRipemd160 ¶
func HashesSha3_256 ¶
func HashesSha3_512 ¶
func IsConstantTimeByteEq ¶
Types ¶
type BlockCipher ¶
type BlockCipher interface { // Encrypts an arbitrarily-sized message (input). Encrypt(input []byte) []byte // Decrypts an arbitrarily-sized message. //return The decrypted message or nil if decryption failed. Decrypt(input []byte) []byte }
BlockCipher Interface for encryption and decryption of data.
type BufferedBlockCipher ¶
type BufferedBlockCipher struct {
// contains filtered or unexported fields
}
func NewPaddedBufferedBlockCipher ¶
func NewPaddedBufferedBlockCipher(block *CBCBlockCipher, padding *PKCS7Padding) *BufferedBlockCipher
func (*BufferedBlockCipher) GetOutputSize ¶
func (ref *BufferedBlockCipher) GetOutputSize(length int) int
type CBCBlockCipher ¶
type CBCBlockCipher struct {
// contains filtered or unexported fields
}
func NewCBCBlockCipher ¶
func NewCBCBlockCipher(aes *AESEngine) *CBCBlockCipher
type Cipher ¶
type Cipher struct {
// contains filtered or unexported fields
}
Cipher Wraps IES encryption and decryption logic.
func NewCipher ¶
func NewCipher(senderKeyPair *KeyPair, recipientKeyPair *KeyPair, engine CryptoEngine) *Cipher
NewCipher creates a cipher around a sender KeyPair and recipient KeyPair. if engine not present - use CryptoEngines.DefaultEngine insend The sender KeyPair. The sender'S private key is required for encryption. The recipient KeyPair. The recipient'S private key is required for decryption.
func NewCipherFromCipher ¶
func NewCipherFromCipher(cipher BlockCipher) *Cipher
NewCipherFromCipher creates a cipher around a cipher.
type CipherParameters ¶
type CipherParameters struct {
// contains filtered or unexported fields
}
func NewParametersWithIV ¶
func NewParametersWithIV(keyParam *KeyParameter, buf []byte) *CipherParameters
type CoordinateSystem ¶
type CoordinateSystem int
CoordinateSystem Available coordinate systems for a group element.
const ( // Affine coordinate system (x, y). AFFINE CoordinateSystem = iota // Projective coordinate system (X:Y:Z) satisfying x=X/Z, y=Y/Z. P2 // Extended projective coordinate system (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT. P3 // Completed coordinate system ((X:Z), (Y:T)) satisfying x=X/Z, y=Y/T. P1xP1 // Precomputed coordinate system (y+x, y-x, 2dxy). PRECOMPUTED // Cached coordinate system (Y+X, Y-X, Z, 2dT). CACHED )
type CryptoEngine ¶
type CryptoEngine interface { // Return The underlying curve. GetCurve() Curve // Creates a DSA signer. CreateDsaSigner(keyPair *KeyPair) DsaSigner // Creates a key generator. CreateKeyGenerator() KeyGenerator //Creates a block cipher. CreateBlockCipher(senderKeyPair *KeyPair, recipientKeyPair *KeyPair) BlockCipher // Creates a key analyzer. CreateKeyAnalyzer() KeyAnalyzer }
CryptoEngine Represents a cryptographic engine that is a factory of crypto-providers.
type Curve ¶
type Curve interface { /** * Gets the name of the curve. * * @return The name of the curve. */ GetName() string /** * Gets the group order. * * @return The group order. */ GetGroupOrder() *big.Int /** * Gets the group order / 2. * * @return The group order / 2. */ GetHalfGroupOrder() uint64 }
Curve Interface for getting information for a curve.
type DsaSigner ¶
type DsaSigner interface { // Signs the SHA3 hash of an arbitrarily sized message. Sign(mess []byte) (*Signature, error) // Verifies that the signature is valid. Verify(mess []byte, signature *Signature) bool // Determines if the signature is canonical. IsCanonicalSignature(signature *Signature) bool // Makes ref signature canonical. MakeSignatureCanonical(signature *Signature) (*Signature, error) }
DsaSigner Interface that supports signing and verification of arbitrarily sized message.
type Ed25519BlockCipher ¶
type Ed25519BlockCipher struct {
// contains filtered or unexported fields
}
Ed25519BlockCipher Implementation of the block cipher for Ed25519.
func NewEd25519BlockCipher ¶
func NewEd25519BlockCipher(senderKeyPair *KeyPair, recipientKeyPair *KeyPair) *Ed25519BlockCipher
func (*Ed25519BlockCipher) Decrypt ¶
func (ref *Ed25519BlockCipher) Decrypt(input []byte) []byte
func (*Ed25519BlockCipher) Encrypt ¶
func (ref *Ed25519BlockCipher) Encrypt(input []byte) []byte
func (*Ed25519BlockCipher) GetSharedKey ¶
func (ref *Ed25519BlockCipher) GetSharedKey(privateKey *PrivateKey, publicKey *PublicKey, salt []byte) ([]byte, error)
type Ed25519CryptoEngine ¶
type Ed25519CryptoEngine struct { }
Ed25519CryptoEngine wraps a cryptographic engine ed25519
func (*Ed25519CryptoEngine) CreateBlockCipher ¶
func (ref *Ed25519CryptoEngine) CreateBlockCipher(senderKeyPair *KeyPair, recipientKeyPair *KeyPair) BlockCipher
CreateBlockCipher implemented interface CryptoEngine method
func (*Ed25519CryptoEngine) CreateDsaSigner ¶
func (ref *Ed25519CryptoEngine) CreateDsaSigner(keyPair *KeyPair) DsaSigner
CreateDsaSigner implemented interface CryptoEngine method
func (*Ed25519CryptoEngine) CreateKeyAnalyzer ¶
func (ref *Ed25519CryptoEngine) CreateKeyAnalyzer() KeyAnalyzer
CreateKeyAnalyzer implemented interface CryptoEngine method
func (*Ed25519CryptoEngine) CreateKeyGenerator ¶
func (ref *Ed25519CryptoEngine) CreateKeyGenerator() KeyGenerator
CreateKeyGenerator implemented interface CryptoEngine method
func (*Ed25519CryptoEngine) GetCurve ¶
func (ref *Ed25519CryptoEngine) GetCurve() Curve
GetCurve implemented interface CryptoEngine method
type Ed25519DsaSigner ¶
type Ed25519DsaSigner struct {
KeyPair *KeyPair
}
Ed25519DsaSigner implement DSasigned interface with Ed25519 algo
func NewEd25519DsaSigner ¶
func NewEd25519DsaSigner(keyPair *KeyPair) *Ed25519DsaSigner
NewEd25519DsaSigner creates a Ed25519 DSA signer.
func (*Ed25519DsaSigner) IsCanonicalSignature ¶
func (ref *Ed25519DsaSigner) IsCanonicalSignature(signature *Signature) bool
func (*Ed25519DsaSigner) MakeSignatureCanonical ¶
func (ref *Ed25519DsaSigner) MakeSignatureCanonical(signature *Signature) (*Signature, error)
type Ed25519EncodedFieldElement ¶
type Ed25519EncodedFieldElement struct { Raw []byte // contains filtered or unexported fields }
Ed25519EncodedFieldElement Represents a field element of the finite field with p=2^255-19 elements. * The value of the field element is held in 2^8 bit representation, i.e. in a byte array. * The length of the array must be 32 or 64.
func NewEd25519EncodedFieldElement ¶
func NewEd25519EncodedFieldElement(Raw []byte) (*Ed25519EncodedFieldElement, error)
NewEd25519EncodedFieldElement creates a new encoded field element. Raw must to have leght 32 or 64 bytes
func PrepareForScalarMultiply ¶
func PrepareForScalarMultiply(key *PrivateKey) *Ed25519EncodedFieldElement
func (*Ed25519EncodedFieldElement) Decode ¶
func (ref *Ed25519EncodedFieldElement) Decode() *Ed25519FieldElement
*
- Decodes ref encoded (32 byte) representation to a field element in its 10 byte 2^25.5 representation.
- The most significant bit is discarded. *
- @return The field element in its 2^25.5 bit representation.
func (*Ed25519EncodedFieldElement) Equals ¶
func (ref *Ed25519EncodedFieldElement) Equals(ge *Ed25519EncodedFieldElement) bool
func (*Ed25519EncodedFieldElement) IsNegative ¶
func (ref *Ed25519EncodedFieldElement) IsNegative() bool
IsNegative Return true if ref is in {1,3,5,...,q-2}
Return false if ref is in {0,2,4,...,q-1}
* Preconditions: * |x| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. * * @return true if ref is in {1,3,5,...,q-2}, false otherwise.
func (*Ed25519EncodedFieldElement) IsNonZero ¶
func (ref *Ed25519EncodedFieldElement) IsNonZero() bool
func (*Ed25519EncodedFieldElement) String ¶
func (ref *Ed25519EncodedFieldElement) String() string
type Ed25519EncodedGroupElement ¶
type Ed25519EncodedGroupElement struct {
Raw []byte
}
Ed25519EncodedGroupElement
func NewEd25519EncodedGroupElement ¶
func NewEd25519EncodedGroupElement(Raw []byte) (*Ed25519EncodedGroupElement, error)
NewEd25519EncodedGroupElement creates a new encoded group element.
func (*Ed25519EncodedGroupElement) Decode ¶
func (ref *Ed25519EncodedGroupElement) Decode() (*Ed25519GroupElement, error)
Decode Decodes ref encoded group element and returns a new group element in P3 coordinates.
func (*Ed25519EncodedGroupElement) Equals ¶
func (ref *Ed25519EncodedGroupElement) Equals(ge *Ed25519EncodedGroupElement) bool
func (*Ed25519EncodedGroupElement) GetAffineX ¶
func (ref *Ed25519EncodedGroupElement) GetAffineX() (*Ed25519FieldElement, error)
GetAffineX gets the affine x-coordinate. * x is recovered in the following way (p = field size): * <br> * x = sign(x) * sqrt((y^2 - 1) / (d * y^2 + 1)) = sign(x) * sqrt(u / v) with u = y^2 - 1 and v = d * y^2 + 1. * Setting ОІ = (u * v^3) * (u * v^7)^((p - 5) / 8) one has ОІ^2 = +-(u / v). * If v * ОІ = -u multiply ОІ with i=sqrt(-1). * Set x := ОІ. * If sign(x) != bit 255 of s then negate x. * @return the affine x-coordinate.
func (*Ed25519EncodedGroupElement) GetAffineY ¶
func (ref *Ed25519EncodedGroupElement) GetAffineY() (*Ed25519FieldElement, error)
func (*Ed25519EncodedGroupElement) String ¶
func (ref *Ed25519EncodedGroupElement) String() string
type Ed25519FieldElement ¶
type Ed25519FieldElement struct {
Raw []intRaw
}
Ed25519FieldElement Represents a element of the finite field with p=2^255-19 elements. Raw[0] ... Raw[9], represent the integer Raw[0] + 2^26 * Raw[1] + 2^51 * Raw[2] + 2^77 * Raw[3] + 2^102 * Raw[4] + ... + 2^230 * Raw[9]. Bounds on each Raw[i] vary depending on context. This implementation is based on the ref10 implementation of SUPERCOP.
func Ed25519FieldElementSqrt ¶
func Ed25519FieldElementSqrt(u Ed25519FieldElement, v Ed25519FieldElement) Ed25519FieldElement
Ed25519FieldElementSqrt Calculates and returns one of the square roots of u / v. * x = (u * v^3) * (u * v^7)^((p - 5) / 8) ==> x^2 = +-(u / v). * Note that ref means x can be sqrt(u / v), -sqrt(u / v), +i * sqrt(u / v), -i * sqrt(u / v). * * @param u The nominator of the fraction. * @param v The denominator of the fraction. * @return The square root of u / v.
func Ed25519Field_D ¶
func Ed25519Field_D() *Ed25519FieldElement
func Ed25519Field_D_Times_TWO ¶
func Ed25519Field_D_Times_TWO() *Ed25519FieldElement
func Ed25519Field_ONE ¶
func Ed25519Field_ONE() *Ed25519FieldElement
func Ed25519Field_TWO ¶
func Ed25519Field_TWO() *Ed25519FieldElement
func Ed25519Field_ZERO ¶
func Ed25519Field_ZERO() *Ed25519FieldElement
func NewEd25519FieldElement ¶
func NewEd25519FieldElement(Raw []intRaw) (*Ed25519FieldElement, error)
NewEd25519FieldElement Creates a field element. Raw The 2^25.5 bit representation of the field element.
func (Ed25519FieldElement) Encode ¶
func (ref Ed25519FieldElement) Encode() *Ed25519EncodedFieldElement
func (*Ed25519FieldElement) Equals ¶
func (ref *Ed25519FieldElement) Equals(ge *Ed25519FieldElement) bool
func (Ed25519FieldElement) IsNegative ¶
func (ref Ed25519FieldElement) IsNegative() bool
func (Ed25519FieldElement) IsNonZero ¶
func (ref Ed25519FieldElement) IsNonZero() bool
IsNonZero gets a value indicating whether or not the field element is non-zero.
func (*Ed25519FieldElement) String ¶
func (ref *Ed25519FieldElement) String() string
type Ed25519GroupElement ¶
type Ed25519GroupElement struct { X *Ed25519FieldElement Y *Ed25519FieldElement Z *Ed25519FieldElement T *Ed25519FieldElement // contains filtered or unexported fields }
*
- A point on the ED25519 curve which represents a group element.
- This implementation is based on the ref10 implementation of SUPERCOP.
- <br>
- Literature:
- [1] Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe and Bo-Yin Yang : High-speed high-security signatures
- [2] Huseyin Hisil, Kenneth Koon-Ho Wong, Gary Carter, Ed Dawson: Twisted Edwards Curves Revisited
- [3] Daniel J. Bernsteina, Tanja Lange: A complete set of addition laws for incomplete Edwards curves
- [4] Daniel J. Bernstein, Peter Birkner, Marc Joye, Tanja Lange and Christiane Peters: Twisted Edwards Curves
- [5] Christiane Pascale Peters: Curves, Codes, and Cryptography (PhD thesis)
- [6] Daniel J. Bernstein, Peter Birkner, Tanja Lange and Christiane Peters: Optimizing float64-base elliptic-curve single-scalar multiplication
Ed25519GroupElement
func NewEd25519GroupElement ¶
func NewEd25519GroupElement(coordinateSystem CoordinateSystem, x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, t *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElement creates a group element for a curve.
func NewEd25519GroupElementAffine ¶
func NewEd25519GroupElementAffine( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementAffine creates a new group element using the AFFINE coordinate system.
func NewEd25519GroupElementCached ¶
func NewEd25519GroupElementCached( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, t *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementCached сreates a new group element using the CACHED coordinate system. (CoordinateSystem.CACHED, YPlusX, YMinusX, Z, T2d)
func NewEd25519GroupElementP1XP1 ¶
func NewEd25519GroupElementP1XP1( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, t *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementP1XP1 Creates a new group element using the P1xP1 coordinate system.
func NewEd25519GroupElementP2 ¶
func NewEd25519GroupElementP2( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementP2 creates a new group element using the P2 coordinate system.
func NewEd25519GroupElementP3 ¶
func NewEd25519GroupElementP3( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement, t *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementP3 creates a new group element using the P3 coordinate system.
func NewEd25519GroupElementPrecomputed ¶
func NewEd25519GroupElementPrecomputed( x *Ed25519FieldElement, y *Ed25519FieldElement, z *Ed25519FieldElement) *Ed25519GroupElement
NewEd25519GroupElementPrecomputed сreates a new group element using the PRECOMPUTED coordinate system. (CoordinateSystem.PRECOMPUTED, yPlusx, yMinusx, xy2d, nil)
func (*Ed25519GroupElement) Encode ¶
func (ref *Ed25519GroupElement) Encode() (*Ed25519EncodedGroupElement, error)
Converts the group element to an encoded point on the curve. * * @return The encoded point as byte array.
func (*Ed25519GroupElement) Equals ¶
func (ref *Ed25519GroupElement) Equals(ge *Ed25519GroupElement) (res bool)
func (*Ed25519GroupElement) GetCoordinateSystem ¶
func (ref *Ed25519GroupElement) GetCoordinateSystem() CoordinateSystem
func (*Ed25519GroupElement) GetT ¶
func (ref *Ed25519GroupElement) GetT() *Ed25519FieldElement
func (*Ed25519GroupElement) GetX ¶
func (ref *Ed25519GroupElement) GetX() *Ed25519FieldElement
func (*Ed25519GroupElement) GetY ¶
func (ref *Ed25519GroupElement) GetY() *Ed25519FieldElement
func (*Ed25519GroupElement) GetZ ¶
func (ref *Ed25519GroupElement) GetZ() *Ed25519FieldElement
func (*Ed25519GroupElement) IsPrecomputedForDoubleScalarMultiplication ¶
func (ref *Ed25519GroupElement) IsPrecomputedForDoubleScalarMultiplication() bool
*
- Gets a value indicating whether or not the group element has a
- precomputed table for float64 scalar multiplication. *
- @return true if it has the table, false otherwise.
func (*Ed25519GroupElement) PrecomputeForDoubleScalarMultiplication ¶
func (ref *Ed25519GroupElement) PrecomputeForDoubleScalarMultiplication()
PrecomputeForDoubleScalarMultiplication Precomputes the group elements used to speed up a float64 scalar multiplication.
func (*Ed25519GroupElement) PrecomputeForScalarMultiplication ¶
func (ref *Ed25519GroupElement) PrecomputeForScalarMultiplication()
PrecomputeForScalarMultiplication precomputes the group elements needed to speed up a scalar multiplication.
func (*Ed25519GroupElement) SatisfiesCurveEquation ¶
func (ref *Ed25519GroupElement) SatisfiesCurveEquation() bool
SatisfiesCurveEquation Verify that the group element satisfies the curve equation. * @return true if the group element satisfies the curve equation, false otherwise.
func (*Ed25519GroupElement) Select ¶
func (ref *Ed25519GroupElement) Select(pos int, b int) (*Ed25519GroupElement, error)
func (*Ed25519GroupElement) String ¶
func (ref *Ed25519GroupElement) String() string
type Ed25519KeyAnalyzer ¶
type Ed25519KeyAnalyzer struct { }
func NewEd25519KeyAnalyzer ¶
func NewEd25519KeyAnalyzer() *Ed25519KeyAnalyzer
func (*Ed25519KeyAnalyzer) IsKeyCompressed ¶
func (ref *Ed25519KeyAnalyzer) IsKeyCompressed(publicKey *PublicKey) bool
type Ed25519KeyGenerator ¶
type Ed25519KeyGenerator struct { }
Ed25519KeyGenerator Implementation of the key generator for Ed25519.
func NewEd25519KeyGenerator ¶
func NewEd25519KeyGenerator() *Ed25519KeyGenerator
func (*Ed25519KeyGenerator) DerivePublicKey ¶
func (ref *Ed25519KeyGenerator) DerivePublicKey(privateKey *PrivateKey) *PublicKey
func (*Ed25519KeyGenerator) GenerateKeyPair ¶
func (ref *Ed25519KeyGenerator) GenerateKeyPair() (*KeyPair, error)
GenerateKeyPair generate key pair use ed25519.GenerateKey
type KeyAnalyzer ¶
type KeyAnalyzer interface { // Gets a Value indicating whether or not the public key is compressed. IsKeyCompressed(publicKey *PublicKey) bool }
KeyAnalyzer Interface to analyze keys.
type KeyGenerator ¶
type KeyGenerator interface { // Creates a random key pair. GenerateKeyPair() (*KeyPair, error) // Derives a public key from a private key. DerivePublicKey(privateKey *PrivateKey) *PublicKey }
KeyGenerator Interface for generating keys.
type KeyPair ¶
type KeyPair struct { *PrivateKey *PublicKey }
KeyPair represent the pair of keys - private & public
func NewKeyPair ¶
func NewKeyPair(privateKey *PrivateKey, publicKey *PublicKey, engine CryptoEngine) (*KeyPair, error)
NewKeyPair The public key is calculated from the private key.
The private key must by nil
if crypto engine is nil - default Engine
func NewKeyPairByEngine ¶
func NewKeyPairByEngine(engine CryptoEngine) (*KeyPair, error)
NewKeyPairByEngine creates a random key pair that is compatible with the specified engine.
func NewRandomKeyPair ¶
NewRandomKeyPair creates a random key pair.
func (*KeyPair) HasPrivateKey ¶
HasPrivateKey Determines if the current key pair has a private key.
type KeyParameter ¶
type KeyParameter struct {
// contains filtered or unexported fields
}
func NewKeyParameter ¶
func NewKeyParameter(buf []byte) *KeyParameter
type PKCS7Padding ¶
type PKCS7Padding struct { }
func NewPKCS7Padding ¶
func NewPKCS7Padding() *PKCS7Padding
type PrivateKey ¶
type PrivateKey struct { Raw []byte // contains filtered or unexported fields }
PrivateKey Represents a private key.
func NewPrivateKey ¶
func NewPrivateKey(raw []byte) *PrivateKey
NewPrivateKey creates a new private key from []byte
func NewPrivateKeyfromBigInt ¶
func NewPrivateKeyfromBigInt(val *big.Int) *PrivateKey
NewPrivateKey creates a new private key from []byte
func NewPrivateKeyfromDecimalString ¶
func NewPrivateKeyfromDecimalString(decimal string) (*PrivateKey, error)
PrivateKeyfromDecimalString creates a private key from a decimal strings.
func NewPrivateKeyfromHexString ¶
func NewPrivateKeyfromHexString(sHex string) (*PrivateKey, error)
PrivatKeyfromHexString creates a private key from a hex strings.
func (*PrivateKey) String ¶
func (ref *PrivateKey) String() string
type PublicKey ¶
type PublicKey struct {
Raw []byte
}
PublicKey Represents a public key.
func NewPublicKeyfromHex ¶
type Signature ¶
Signature
func NewSignature ¶
NewSignature R and S must fit into 32 bytes
func NewSignatureFromBytes ¶
NewSignatureFromBytes Creates a new signature from bytes array 64
type Signer ¶
type Signer struct {
// contains filtered or unexported fields
}
Signer wraps DSA signing and verification logic.
func NewSignerFromKeyPair ¶
func NewSignerFromKeyPair(keyPair *KeyPair, engine CryptoEngine) *Signer
NewSigner creates a signer around a KeyPair.
func (*Signer) IsCanonicalSignature ¶
IsCanonicalSignature implemented interface DsaSigner method
func (*Signer) MakeSignatureCanonical ¶
MakeSignatureCanonical implemented interface DsaSigner method