mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
added uncompressed trust anchor pub key processing
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
066c1a7667
commit
0c52156406
@ -35,6 +35,12 @@ func validatePublicKey(pubkey string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
//uncompressed key
|
||||
if len(pubkeyBytes) == 64 {
|
||||
return true
|
||||
}
|
||||
|
||||
// compressed key
|
||||
// Check if byte slice has correct length
|
||||
if len(pubkeyBytes) != 33 {
|
||||
return false
|
||||
|
||||
@ -71,6 +71,18 @@ func TestMsgServerRegisterTrustAnchor(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgServerRegisterTrustAnchorUncompressedKey(t *testing.T) {
|
||||
t.Parallel()
|
||||
pk := "6003d0ab9af4ec112629195a7266a244aecf1ac7691da0084be3e7ceea2ee71571b0963fffd9c80a640317509a681ac66c2ed70ecc9f317a0d2b1a9bff94ff74"
|
||||
ta := moduleobject.TrustAnchor(pk)
|
||||
msg := types.NewMsgRegisterTrustAnchor(pk, &ta)
|
||||
msgServer, ctx := setupMsgServer(t)
|
||||
res, err := msgServer.RegisterTrustAnchor(ctx, msg)
|
||||
if assert.NoError(t, err) {
|
||||
assert.Equal(t, &types.MsgRegisterTrustAnchorResponse{}, res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMsgServerRegisterTrustAnchorTwice(t *testing.T) {
|
||||
t.Parallel()
|
||||
_, pk := sample.KeyPair()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user