0
|
1 /**
|
|
2 * This file is part of the dcrypt project.
|
|
3 *
|
|
4 * Copyright: Copyright (C) dcrypt contributors 2008. All rights reserved.
|
|
5 * License: MIT
|
|
6 * Authors: Thomas Dixon
|
|
7 */
|
|
8
|
|
9 module dcrypt.crypto.BlockCipherPadding;
|
|
10
|
|
11 public import dcrypt.crypto.errors.InvalidPaddingError;
|
|
12
|
|
13 /** Base padding class for implementing block padding schemes. */
|
|
14 abstract class BlockCipherPadding {
|
|
15 /** Returns: The name of the padding scheme implemented. */
|
|
16 char[] name();
|
|
17
|
|
18 /**
|
|
19 * Pad the (last) block of plaintext to block length.
|
|
20 *
|
|
21 * Params:
|
|
22 * input_ = Plaintext block to be padded.
|
|
23 * inOffset = Offset at which to begin padding input_.
|
|
24 *
|
|
25 * Returns: The number of padding bytes added.
|
|
26 */
|
|
27 uint padBlock(void[] input_, uint inOff);
|
|
28
|
|
29 /**
|
|
30 * Return the number of pad bytes in the block.
|
|
31 *
|
|
32 * Params:
|
|
33 * input_ = Padded block of which to count the pad bytes.
|
|
34 *
|
|
35 * Returns: The number of pad bytes in the block.
|
|
36 *
|
|
37 * Throws: dcrypt.crypto.errors.InvalidPaddingError if
|
|
38 * pad length cannot be discerned.
|
|
39 */
|
|
40 uint padLength(void[] input_);
|
|
41 }
|