|
| 1 | +/* |
| 2 | + This file is part of the iText (R) project. |
| 3 | + Copyright (c) 1998-2025 Apryse Group NV |
| 4 | + Authors: Apryse Software. |
| 5 | +
|
| 6 | + This program is offered under a commercial and under the AGPL license. |
| 7 | + For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. |
| 8 | +
|
| 9 | + AGPL licensing: |
| 10 | + This program is free software: you can redistribute it and/or modify |
| 11 | + it under the terms of the GNU Affero General Public License as published by |
| 12 | + the Free Software Foundation, either version 3 of the License, or |
| 13 | + (at your option) any later version. |
| 14 | +
|
| 15 | + This program is distributed in the hope that it will be useful, |
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + GNU Affero General Public License for more details. |
| 19 | +
|
| 20 | + You should have received a copy of the GNU Affero General Public License |
| 21 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | + */ |
| 23 | +package com.itextpdf.kernel.crypto.securityhandler; |
| 24 | + |
| 25 | +/** |
| 26 | + * Creates an AES Cipher with CBC and no padding. |
| 27 | + */ |
| 28 | +class AESCipherCBCnoPad { |
| 29 | + |
| 30 | + com.itextpdf.kernel.crypto.AESCipherCBCnoPad aESCipherCBCnoPad; |
| 31 | + |
| 32 | + /** |
| 33 | + * Creates a new instance of AESCipher with CBC and no padding |
| 34 | + * |
| 35 | + * @param forEncryption if true the cipher is initialised for |
| 36 | + * encryption, if false for decryption |
| 37 | + * @param key the key to be used in the cipher |
| 38 | + */ |
| 39 | + AESCipherCBCnoPad(boolean forEncryption, byte[] key) { |
| 40 | + aESCipherCBCnoPad = new com.itextpdf.kernel.crypto.AESCipherCBCnoPad(forEncryption, key); |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * Creates a new instance of AESCipher with CBC and no padding |
| 45 | + * |
| 46 | + * @param forEncryption if true the cipher is initialised for |
| 47 | + * encryption, if false for decryption |
| 48 | + * @param key the key to be used in the cipher |
| 49 | + * @param initVector initialization vector to be used in cipher |
| 50 | + */ |
| 51 | + AESCipherCBCnoPad(boolean forEncryption, byte[] key, byte[] initVector) { |
| 52 | + aESCipherCBCnoPad = new com.itextpdf.kernel.crypto.AESCipherCBCnoPad(forEncryption, key, initVector); |
| 53 | + } |
| 54 | + |
| 55 | + byte[] processBlock(byte[] inp, int inpOff, int inpLen) { |
| 56 | + return aESCipherCBCnoPad.processBlock(inp, inpOff, inpLen); |
| 57 | + } |
| 58 | +} |
0 commit comments