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 ¶
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)
Click to show internal directories.
Click to hide internal directories.