Unverified Commit f25c826a authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #3 from libp2p/feat/sig-size

feat: add Size function to PublicKey
parents 1934e456 f9968444
Pipeline #409 failed with stages
in 0 seconds
......@@ -4,6 +4,7 @@ Forked from https://github.com/spacemonkeygo/openssl (unmaintained) to add:
1. FreeBSD support.
2. Key equality checking.
3. A function to get the size of signatures produced by a key.
---
......
......@@ -4,3 +4,5 @@ require (
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb // indirect
)
go 1.12
......@@ -88,6 +88,9 @@ type PublicKey interface {
// Equal compares the key with the passed in key.
Equal(key PublicKey) bool
// Size returns the size (in bytes) of signatures created with this key.
Size() int
evpPKey() *C.EVP_PKEY
}
......@@ -120,6 +123,10 @@ func (key *pKey) KeyType() NID {
return NID(C.EVP_PKEY_id(key.key))
}
func (key *pKey) Size() int {
return int(C.EVP_PKEY_size(key.key))
}
func (key *pKey) BaseType() NID {
return NID(C.EVP_PKEY_base_id(key.key))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment