| QuickTest | Contents | Index
Codec.Encryption.Padding |
Portability | portable
Stability | experimental
Maintainer | dominic.steinitz@blueyonder.co.uk
Contents
Function types
Description
Padding algorithms for use with block ciphers. This module currently supports: PKCS5 padding and unpadding. Null padding and unpadding.
Synopsis
pkcs5 :: (Integral a, Bits a) => [Octet] -> [a]
unPkcs5 :: (Bits a, Integral a) => [a] -> [Octet]
padNulls :: (Integral a, Bits a) => [Octet] -> [a]
unPadNulls :: (Bits a, Integral a) => [a] -> [Octet]
Function types
pkcs5 :: (Integral a, Bits a) => [Octet] -> [a]
When the last block of plaintext is shorter than the block size then it must be padded. PKCS5 specifies that the padding octets should each contain the number of octets which must be stripped off. So, for example, with a block size of 8, "0a0b0c" will be padded with "05" resulting in "0a0b0c0505050505". If the final block is a full block of 8 octets then a whole block of "0808080808080808" is appended.
unPkcs5 :: (Bits a, Integral a) => [a] -> [Octet]
Take a list of blocks padded using the method described in PKCS5 (see http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5) and return the list of unpadded octets. NB this function does not currently check that the padded block is correctly formed and should only be used for blocks that have been padded correctly.
padNulls :: (Integral a, Bits a) => [Octet] -> [a]
When the last block of plaintext is shorter than the block size then it must be padded. Nulls padding specifies that the padding octets should each contain a null. So, for example, with a block size of 8, "0a0b0c" will be padded to "0a0b0c0000000000". If the final block is a full block of 8 octets then a whole block of "0000000000000000" is appended. NB this is only suitable for data which does not contain nulls, for example, ASCII.
unPadNulls :: (Bits a, Integral a) => [a] -> [Octet]
Take a list of blocks padded with nulls and return the list of unpadded octets. NB if the blocks contain a null then the result is unpredictable.
Produced by Haddock version 0.8