OSDN Git Service

add log (#373)
[bytom/vapor.git] / crypto / csp / csp.go
1 // csp is a package of cipher service provider
2
3 package csp
4
5 import (
6         "crypto"
7 )
8
9 // var currentCrypt XXXXX
10
11 // var (
12 //      currentCrypto map[string]XXXX
13 // )
14
15 // func init() {
16 //      currentCrypt = currentCrypto[config。?????]
17 // }
18
19 type XPrvKeyer interface {
20         // XPub derives an extended public key from a given xprv.
21         XPub() XPubKeyer
22         // Derive generates a child xprv by recursively deriving
23         // non-hardened child xprvs over the list of selectors:
24         // `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`
25         Derive(path [][]byte) XPrvKeyer
26         // Sign creates an EdDSA signature using expanded private key
27         // derived from the xprv.
28         Sign(msg []byte) []byte
29 }
30
31 type XPubKeyer interface {
32         // PublicKey extracts the public key from an xpub.
33         PublicKey() crypto.PublicKey
34         // Derive generates a child xpub by recursively deriving
35         // non-hardened child xpubs over the list of selectors:
36         // `Derive([a,b,c,...]) == Child(a).Child(b).Child(c)...`
37         Derive(path [][]byte) XPubKeyer
38         // Verify checks an EdDSA signature using public key
39         Verify(msg []byte, sig []byte) bool
40 }