()
| 17 | const TestCount = 1000 |
| 18 | |
| 19 | func generateKeyPair() (pubkey, privkey []byte) { |
| 20 | key, err := ecdsa.GenerateKey(S256(), rand.Reader) |
| 21 | if err != nil { |
| 22 | panic(err) |
| 23 | } |
| 24 | pubkey = elliptic.Marshal(S256(), key.X, key.Y) |
| 25 | |
| 26 | privkey = make([]byte, 32) |
| 27 | blob := key.D.Bytes() |
| 28 | copy(privkey[32-len(blob):], blob) |
| 29 | |
| 30 | return pubkey, privkey |
| 31 | } |
| 32 | |
| 33 | func csprngEntropy(n int) []byte { |
| 34 | buf := make([]byte, n) |
no test coverage detected