Skip to content

Commit 986d068

Browse files
committed
Fix MarshallPrivate when private key is type [32]byte.
1 parent c09737a commit 986d068

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

hpke.go

+14
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,20 @@ func MarshallPrivate(params *Params, key interface{}) (keyBytes []byte, err erro
8383
} else {
8484
err = errors.New("incorrect private key")
8585
}
86+
case [32]byte:
87+
if len(t) == 32 {
88+
keyBytes = make([]byte, 32)
89+
copy(keyBytes[:], t[:])
90+
} else {
91+
err = errors.New("incorrect private key")
92+
}
93+
case *[32]byte:
94+
if len(*t) == 32 {
95+
keyBytes = make([]byte, 32)
96+
copy(keyBytes[:], (*t)[:])
97+
} else {
98+
err = errors.New("incorrect private key")
99+
}
86100
default:
87101
err = errors.New("incorrect private key")
88102
}

0 commit comments

Comments
 (0)