|
@@ -499,6 +499,13 @@ func TestNebulaCertificate_Copy(t *testing.T) {
|
|
|
util.AssertDeepCopyEqual(t, c, cc)
|
|
|
}
|
|
|
|
|
|
+func TestUnmarshalNebulaCertificate(t *testing.T) {
|
|
|
+ // Test that we don't panic with an invalid certificate (#332)
|
|
|
+ data := []byte("\x98\x00\x00")
|
|
|
+ _, err := UnmarshalNebulaCertificate(data)
|
|
|
+ assert.EqualError(t, err, "encoded Details was nil")
|
|
|
+}
|
|
|
+
|
|
|
func newTestCaCert(before, after time.Time, ips, subnets []*net.IPNet, groups []string) (*NebulaCertificate, []byte, []byte, error) {
|
|
|
pub, priv, err := ed25519.GenerateKey(rand.Reader)
|
|
|
if before.IsZero() {
|