Also check length >= 32.

This commit is contained in:
Jacob Hoffman-Andrews 2015-09-22 14:27:38 -07:00
parent 16e8ff9d24
commit 73216a461d
1 changed files with 4 additions and 3 deletions

View File

@ -311,9 +311,10 @@ func StringToSerial(serial string) (*big.Int, error) {
}
func ValidSerial(serial string) bool {
// We check only the max length of serial, because there are a couple of
// initial certificates with a shorter serial in the prod DB.
if len(serial) > 36 {
// Originally, serial numbers were 32 hex characters long. We later increased
// them to 36, but we allow the shorter ones because they exist in some
// production databases.
if len(serial) < 32 && len(serial) > 36 {
return false
}
_, err := hex.DecodeString(serial)