fix a test
This commit is contained in:
@ -179,6 +179,7 @@ func ReadCertificate(data []byte) (certificate Certificate, remainder []byte, er
|
||||
if err != nil {
|
||||
switch err.Error() {
|
||||
case "error parsing certificate length: certificate is too short":
|
||||
certificate.CertLen = 0
|
||||
return
|
||||
case "certificate parsing warning: certificate data is shorter than specified by length":
|
||||
//err = nil
|
||||
|
@ -240,6 +240,7 @@ func ReadKeyCertificate(data []byte) (key_certificate KeyCertificate, err error)
|
||||
"reason": "not enough data",
|
||||
}).Error("error parsing key certificate")
|
||||
err = errors.New("error parsing key certificate: not enough data")
|
||||
key_certificate.SPKType = Integer(data[:])
|
||||
return
|
||||
}
|
||||
key_certificate.SPKType = Integer(data[:2])
|
||||
|
@ -12,7 +12,7 @@ func TestCertificateWithMissingData(t *testing.T) {
|
||||
data := make([]byte, 128+256)
|
||||
data = append(data, cert_data...)
|
||||
keys_and_cert, _, err := ReadKeysAndCert(data)
|
||||
|
||||
assert.Nil(err)
|
||||
cert, err := keys_and_cert.GetCertificate()
|
||||
if assert.NotNil(err) {
|
||||
assert.Equal("certificate parsing warning: certificate data is shorter than specified by length", err.Error())
|
||||
|
Reference in New Issue
Block a user