crypto

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomUint64

func RandomUint64() uint64

Types

type Hash

type Hash struct {
	types.Hash
}

Hash is a type-wrapper for exonum.Hash; hex-encoded result of the SHA256. Wrappers implements

func (*Hash) Decode

func (key *Hash) Decode(str string) (err error)

Decode `Hash` from hex string.

func (*Hash) Encode

func (key *Hash) Encode() string

Encode `Hash` into hex string.

func (Hash) FromData

func (Hash) FromData(data []byte) Hash

FromData returns the SHA256 checksum of the data as `Hash`

func (Hash) FromString

func (Hash) FromString(raw string) (Hash, error)

FromString returns new `Hash` decoded from hex string.

func (Hash) MarshalJSON

func (key Hash) MarshalJSON() ([]byte, error)

MarshalJSON convert `Hash` into hex string and than into json.

func (*Hash) MarshalText added in v0.6.0

func (key *Hash) MarshalText() (text []byte, err error)

MarshalText convert `Hash` into hex string and than into textual representation.

func (*Hash) MarshalYAML added in v0.6.0

func (key *Hash) MarshalYAML() (interface{}, error)

MarshalYAML convert `Hash` into hex string and than into yaml.

func (*Hash) Scan

func (key *Hash) Scan(src interface{}) error

Value is generated so Hash satisfies db row driver.Scanner.

func (*Hash) String

func (key *Hash) String() string

Encode `Hash` into hex string.

func (*Hash) UnmarshalJSON

func (key *Hash) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal `Hash` from json as a hex string and `Decode`.

func (*Hash) UnmarshalText added in v0.6.0

func (key *Hash) UnmarshalText(text []byte) error

UnmarshalText unmarshal `Hash` from textual representation as a hex string and `Decode`.

func (*Hash) UnmarshalYAML added in v0.6.0

func (key *Hash) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshal `Hash` from yaml as a hex string and `Decode`.

func (Hash) Value

func (key Hash) Value() (driver.Value, error)

Value is generated so Hash satisfies db row driver.Valuer.

type KeyPair

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

func (KeyPair) FromSecret

func (KeyPair) FromSecret(secretKey SecretKey) KeyPair

func (KeyPair) FromSecretString added in v0.6.0

func (KeyPair) FromSecretString(secretKeyStr string) (KeyPair, error)

func (KeyPair) New

func (KeyPair) New(key PublicKey, secretKey SecretKey) KeyPair

func (*KeyPair) PublicKey

func (kp *KeyPair) PublicKey() PublicKey

func (KeyPair) Random

func (KeyPair) Random() KeyPair

func (*KeyPair) SecretKey

func (kp *KeyPair) SecretKey() *SecretKey

func (KeyPair) Sign

func (kp KeyPair) Sign(data []byte) Signature

func (KeyPair) Verify

func (kp KeyPair) Verify(data []byte, signature Signature) bool

type PublicKey

type PublicKey struct {
	types.PublicKey
}

PublicKey wrapper on top of `exonum.PublicKey` and `ed25519.PublicKey`

func (*PublicKey) Decode

func (key *PublicKey) Decode(str string) (err error)

Decode `PublicKey` from hex string.

func (*PublicKey) Encode

func (key *PublicKey) Encode() string

Encode `PublicKey` into hex string.

func (PublicKey) FromString

func (PublicKey) FromString(raw string) (PublicKey, error)

FromString returns new `PublicKey` decoded from hex string.

func (PublicKey) MarshalJSON

func (key PublicKey) MarshalJSON() ([]byte, error)

MarshalJSON convert `PublicKey` into hex string and than into json.

func (*PublicKey) MarshalText added in v0.6.0

func (key *PublicKey) MarshalText() (text []byte, err error)

MarshalText convert `PublicKey` into hex string and than into textual representation.

func (*PublicKey) MarshalYAML added in v0.6.0

func (key *PublicKey) MarshalYAML() (interface{}, error)

MarshalYAML convert `PublicKey` into hex string and than into yaml.

func (PublicKey) New

New returns new `PublicKey`.

func (*PublicKey) Scan

func (key *PublicKey) Scan(src interface{}) error

Value is generated so PublicKey satisfies db row driver.Scanner.

func (*PublicKey) String

func (key *PublicKey) String() string

Encode `PublicKey` into hex string.

func (*PublicKey) ToPublic

func (key *PublicKey) ToPublic() ed25519.PublicKey

ToPublic cast `key` to `ed25519.PublicKey`.

func (*PublicKey) UnmarshalJSON

func (key *PublicKey) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal `PublicKey` from json as a hex string and `Decode`.

func (*PublicKey) UnmarshalText added in v0.6.0

func (key *PublicKey) UnmarshalText(text []byte) error

UnmarshalText unmarshal `PublicKey` from textual representation as a hex string and `Decode`.

func (*PublicKey) UnmarshalYAML added in v0.6.0

func (key *PublicKey) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshal `PublicKey` from yaml as a hex string and `Decode`.

func (PublicKey) Value

func (key PublicKey) Value() (driver.Value, error)

Value is generated so PublicKey satisfies db row driver.Valuer.

func (*PublicKey) Verify

func (key *PublicKey) Verify(data []byte, signature Signature) bool

Verify check is data was signed by secret from this `PublicKey`

type SecretKey

type SecretKey struct {
	types.SecretKey
}

SecretKey wrapper on top of `exonum.SecretKey` and `ed25519.PrivateKey`

func (*SecretKey) Decode

func (key *SecretKey) Decode(str string) (err error)

Decode `SecretKey` from hex string.

func (*SecretKey) Encode

func (key *SecretKey) Encode() string

Encode `SecretKey` into hex string.

func (SecretKey) FromString

func (SecretKey) FromString(raw string) (SecretKey, error)

FromString returns new `SecretKey` decoded from hex string.

func (*SecretKey) GetPublic

func (key *SecretKey) GetPublic() PublicKey

GetPublic cast `SecretKey` to `PublicKey`

func (SecretKey) MarshalJSON

func (key SecretKey) MarshalJSON() ([]byte, error)

MarshalJSON convert `SecretKey` into hex string and than into json.

func (*SecretKey) MarshalText added in v0.6.0

func (key *SecretKey) MarshalText() (text []byte, err error)

MarshalText convert `SecretKey` into hex string and than into textual representation.

func (*SecretKey) MarshalYAML added in v0.6.0

func (key *SecretKey) MarshalYAML() (interface{}, error)

MarshalYAML convert `SecretKey` into hex string and than into yaml.

func (SecretKey) New

New returns new `SecretKey`.

func (*SecretKey) Scan

func (key *SecretKey) Scan(src interface{}) error

Value is generated so SecretKey satisfies db row driver.Scanner.

func (*SecretKey) Sign

func (key *SecretKey) Sign(data []byte) Signature

Sign creates `Signature` of passed data by this `SecretKey`

func (*SecretKey) String

func (key *SecretKey) String() string

Encode `SecretKey` into hex string.

func (*SecretKey) ToPrivate

func (key *SecretKey) ToPrivate() ed25519.PrivateKey

ToPrivate cast `key` to `ed25519.PrivateKey`.

func (*SecretKey) UnmarshalJSON

func (key *SecretKey) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal `SecretKey` from json as a hex string and `Decode`.

func (*SecretKey) UnmarshalText added in v0.6.0

func (key *SecretKey) UnmarshalText(text []byte) error

UnmarshalText unmarshal `SecretKey` from textual representation as a hex string and `Decode`.

func (*SecretKey) UnmarshalYAML added in v0.6.0

func (key *SecretKey) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshal `SecretKey` from yaml as a hex string and `Decode`.

func (SecretKey) Value

func (key SecretKey) Value() (driver.Value, error)

Value is generated so SecretKey satisfies db row driver.Valuer.

type Signature

type Signature []byte

func (*Signature) Decode

func (key *Signature) Decode(str string) error

Decode `Signature` from hex string.

func (*Signature) Encode

func (key *Signature) Encode() string

Encode `Signature` into hex string.

func (Signature) FromString

func (Signature) FromString(raw string) (Signature, error)

FromString returns new `Signature` decoded from hex string.

func (Signature) MarshalJSON

func (key Signature) MarshalJSON() ([]byte, error)

MarshalJSON convert `Signature` into hex string and than into json.

func (*Signature) MarshalText added in v0.6.0

func (key *Signature) MarshalText() (text []byte, err error)

MarshalText convert `Signature` into hex string and than into textual representation.

func (*Signature) MarshalYAML added in v0.6.0

func (key *Signature) MarshalYAML() (interface{}, error)

MarshalYAML convert `Signature` into hex string and than into yaml.

func (*Signature) Scan

func (key *Signature) Scan(src interface{}) error

Value is generated so Signature satisfies db row driver.Scanner.

func (*Signature) String

func (key *Signature) String() string

Encode `Signature` into hex string.

func (*Signature) UnmarshalJSON

func (key *Signature) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal `Signature` from json as a hex string and `Decode`.

func (*Signature) UnmarshalText added in v0.6.0

func (key *Signature) UnmarshalText(text []byte) error

UnmarshalText unmarshal `Signature` from textual representation as a hex string and `Decode`.

func (*Signature) UnmarshalYAML added in v0.6.0

func (key *Signature) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshal `Signature` from yaml as a hex string and `Decode`.

func (Signature) Value

func (key Signature) Value() (driver.Value, error)

Value is generated so Signature satisfies db row driver.Valuer.

Jump to

Keyboard shortcuts

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