ogcrypto_interface

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var CryptoNameMap = map[string]CryptoType{
	"secp256k1": CryptoTypeSecp256k1,
	"ed25519":   CryptoTypeEd25519,
}

Functions

This section is empty.

Types

type CryptoType

type CryptoType int8
const (
	CryptoTypeEd25519 CryptoType = iota
	CryptoTypeSecp256k1
)

func (CryptoType) String

func (c CryptoType) String() string

type ISigner

type ISigner interface {
	GetCryptoType() CryptoType
	Sign(privKey PrivateKey, msg []byte) Signature
	PubKey(privKey PrivateKey) PublicKey
	Verify(pubKey PublicKey, signature Signature, msg []byte) bool
	RandomKeyPair() (publicKey PublicKey, privateKey PrivateKey)
	Encrypt(publicKey PublicKey, m []byte) (ct []byte, err error)
	Decrypt(p PrivateKey, ct []byte) (m []byte, err error)
	PublicKeyFromBytes(b []byte) PublicKey
	CanRecoverPubFromSig() bool
}

type PrivateKey

type PrivateKey struct {
	Type     CryptoType
	KeyBytes []byte
}

func (*PrivateKey) DebugString

func (p *PrivateKey) DebugString() string

func (*PrivateKey) String

func (p *PrivateKey) String() string

func (*PrivateKey) ToBytes

func (p *PrivateKey) ToBytes() []byte

type PublicKey

type PublicKey struct {
	Type     CryptoType
	KeyBytes []byte
}

func (*PublicKey) DebugString

func (p *PublicKey) DebugString() string

func (*PublicKey) String

func (p *PublicKey) String() string

func (*PublicKey) ToBytes

func (p *PublicKey) ToBytes() []byte

type PublicKeys

type PublicKeys []PublicKey

func (PublicKeys) Len

func (h PublicKeys) Len() int

func (PublicKeys) Less

func (h PublicKeys) Less(i, j int) bool

func (PublicKeys) Swap

func (h PublicKeys) Swap(i, j int)

type Signature

type Signature struct {
	Type           CryptoType
	SignatureBytes []byte
}

func (*Signature) DebugString

func (p *Signature) DebugString() string

func (*Signature) String

func (p *Signature) String() string

func (*Signature) ToBytes

func (p *Signature) ToBytes() []byte

Jump to

Keyboard shortcuts

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