crypto

package
v0.0.0-...-25e0359 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2018 License: Apache-2.0 Imports: 14 Imported by: 0

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

View Source
const COMPRESSED_KEY_SIZE = 32
View Source
const Ed25519FieldI = "b0a00e4a271beec478e42fad0618432fa7d7fb3d99004d2b0bdfc14f8024832b"

Variables

View Source
var A = &Ed25519FieldElement{[]intRaw{
	486662, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}}
View Source
var CryptoEngines = cryptoEngines{
	&Ed25519CryptoEngine{},
	&Ed25519CryptoEngine{},
}
View Source
var Ed25519Curve = &ed25519Curve{}
View Source
var Ed25519Group = &ed25519Group{}

Ed25519Groupp

View Source
var MathUtils mathUtils
View Source
var SqrtM1 = &Ed25519FieldElement{[]intRaw{
	-32595792, -7943725, 9377950, 3500415, 12389472, -272473, -25146209, -2005654, 326686, 11406482,
}}

Functions

func BigInteger_ONE

func BigInteger_ONE() *big.Int

func BigInteger_ZERO

func BigInteger_ZERO() *big.Int

src/test/java/io/nem/core/crypto/ed25519/arithmetic/MathUtils.java

func Ed25519Field_P

func Ed25519Field_P() *big.Int

P: 2^255 - 19

func Ed25519Field_ZERO_LONG

func Ed25519Field_ZERO_LONG() []byte

func Ed25519Field_ZERO_SHORT

func Ed25519Field_ZERO_SHORT() []byte

func HashesRipemd160

func HashesRipemd160(b []byte) ([]byte, error)

func HashesSha3_256

func HashesSha3_256(b []byte) ([]byte, error)

func HashesSha3_512

func HashesSha3_512(inputs ...[]byte) ([]byte, error)

func IsConstantTimeByteEq

func IsConstantTimeByteEq(b, c int) int

func XMul_YModInverseAndMod_P

func XMul_YModInverseAndMod_P(x *big.Int, y *big.Int) *big.Int

Types

type AESEngine

type AESEngine struct{}

func NewAESEngine

func NewAESEngine() *AESEngine

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.

func (*Cipher) Decrypt

func (ref *Cipher) Decrypt(input []byte) []byte

func (*Cipher) Encrypt

func (ref *Cipher) Encrypt(input []byte) []byte

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)

func (*Ed25519DsaSigner) Sign

func (ref *Ed25519DsaSigner) Sign(mess []byte) (*Signature, error)

func (*Ed25519DsaSigner) Verify

func (ref *Ed25519DsaSigner) Verify(mess []byte, signature *Signature) (res bool)

Verify reports whether sig is a valid signature of message 'data' by publicKey. It prevent panic inside ed25519.Verify

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

*

  • 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 (*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

Decode Decodes ref encoded group element and returns a new group element in P3 coordinates.

func (*Ed25519EncodedGroupElement) Equals

func (*Ed25519EncodedGroupElement) GetAffineX

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 (*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 (*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

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

NewEd25519GroupElementCached сreates a new group element using the CACHED coordinate system. (CoordinateSystem.CACHED, YPlusX, YMinusX, Z, T2d)

func NewEd25519GroupElementP1XP1

NewEd25519GroupElementP1XP1 Creates a new group element using the P1xP1 coordinate system.

func NewEd25519GroupElementP2

NewEd25519GroupElementP2 creates a new group element using the P2 coordinate system.

func NewEd25519GroupElementP3

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

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 (*Ed25519GroupElement) GetX

func (*Ed25519GroupElement) GetY

func (*Ed25519GroupElement) GetZ

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

func NewRandomKeyPair() (*KeyPair, error)

NewRandomKeyPair creates a random key pair.

func (*KeyPair) HasPrivateKey

func (ref *KeyPair) HasPrivateKey() bool

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 NewPublicKey

func NewPublicKey(raw []byte) *PublicKey

NewPublicKey creates a new public key.

func NewPublicKeyfromHex

func NewPublicKeyfromHex(hStr string) (*PublicKey, error)

func (*PublicKey) String

func (ref *PublicKey) String() string

type Signature

type Signature struct {
	R []byte
	S []byte
}

Signature

func NewSignature

func NewSignature(r []byte, s []byte) (*Signature, error)

NewSignature R and S must fit into 32 bytes

func NewSignatureFromBigInt

func NewSignatureFromBigInt(rInt, sInt *big.Int) (*Signature, error)

func NewSignatureFromBytes

func NewSignatureFromBytes(b []byte) (*Signature, error)

NewSignatureFromBytes Creates a new signature from bytes array 64

func (*Signature) Bytes

func (ref *Signature) Bytes() []byte

Bytes Gets a little-endian 64-byte representation of the signature.

func (*Signature) GetR

func (ref *Signature) GetR() *big.Int

*

  • Gets the R-part of the signature. *
  • @return The R-part of the signature.

func (*Signature) GetS

func (ref *Signature) GetS() *big.Int

GetS Gets the S-part of the signature.

func (*Signature) String

func (ref *Signature) String() string

type Signer

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

Signer wraps DSA signing and verification logic.

func NewSigner

func NewSigner(signer DsaSigner) *Signer

NewSignerFromDsaSigner Creates a signer around a DsaSigner.

func NewSignerFromKeyPair

func NewSignerFromKeyPair(keyPair *KeyPair, engine CryptoEngine) *Signer

NewSigner creates a signer around a KeyPair.

func (*Signer) IsCanonicalSignature

func (ref *Signer) IsCanonicalSignature(signature *Signature) bool

IsCanonicalSignature implemented interface DsaSigner method

func (*Signer) MakeSignatureCanonical

func (ref *Signer) MakeSignatureCanonical(signature *Signature) (*Signature, error)

MakeSignatureCanonical implemented interface DsaSigner method

func (*Signer) Sign

func (ref *Signer) Sign(data []byte) (*Signature, error)

Sign implemented interface DsaSigner method

func (*Signer) Verify

func (ref *Signer) Verify(data []byte, signature *Signature) bool

Verify implemented interface DsaSigner method

Jump to

Keyboard shortcuts

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