fix validKeyName to account unicode again
It used to, but that was lost in the bytestring conversion recently. 20 * 4 = 80, but I only increased it to 64, which would be up to 16 4-byte unicode characters.
This commit is contained in:
parent
745ecccd0e
commit
901fba3173
1 changed files with 3 additions and 2 deletions
5
Key.hs
5
Key.hs
|
@ -170,14 +170,15 @@ splitKeyNameExtension' keyname = S8.span (/= '.') keyname
|
||||||
- including such keys would not be secure.
|
- including such keys would not be secure.
|
||||||
-
|
-
|
||||||
- The maximum extension length ever generated for such a key was 8
|
- The maximum extension length ever generated for such a key was 8
|
||||||
- characters; 20 is used here to give a little future wiggle-room.
|
- characters, but they may be unicode which could use up to 4 bytes each,
|
||||||
|
- so 32 bytes. 64 bytes is used here to give a little future wiggle-room.
|
||||||
- The SHA1 common-prefix attack needs 128 bytes of data.
|
- The SHA1 common-prefix attack needs 128 bytes of data.
|
||||||
-}
|
-}
|
||||||
validKeyName :: KeyVariety -> S.ByteString -> Bool
|
validKeyName :: KeyVariety -> S.ByteString -> Bool
|
||||||
validKeyName kv name
|
validKeyName kv name
|
||||||
| hasExt kv =
|
| hasExt kv =
|
||||||
let ext = snd $ splitKeyNameExtension' name
|
let ext = snd $ splitKeyNameExtension' name
|
||||||
in S.length ext <= 20
|
in S.length ext <= 64
|
||||||
| otherwise = True
|
| otherwise = True
|
||||||
|
|
||||||
instance Arbitrary Key where
|
instance Arbitrary Key where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue