Fix PKCS#1 v1.5 padding
The padding string is at least 8 bytes long + 3 other bytes, so it should be 11.
This commit is contained in:
parent
0f43451b4f
commit
f4e094aacb
@ -111,8 +111,8 @@ pad len m
|
||||
-- | Produce a standard PKCS1.5 padding for signature
|
||||
padSignature :: ByteArray signature => Int -> signature -> Either Error signature
|
||||
padSignature klen signature
|
||||
| klen < siglen+1 = Left SignatureTooLong
|
||||
| otherwise = Right (B.pack padding `B.append` signature)
|
||||
| klen < siglen + 11 = Left SignatureTooLong
|
||||
| otherwise = Right (B.pack padding `B.append` signature)
|
||||
where
|
||||
siglen = B.length signature
|
||||
padding = 0 : 1 : (replicate (klen - siglen - 3) 0xff ++ [0])
|
||||
|
||||
Loading…
Reference in New Issue
Block a user