| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| AbstractBcCbcPaddedCipherFactory | 37 | 8 | 0% | 5 | 4 | 0.7333333573.3% |
|
Class AbstractBcCbcPaddedCipherFactory |
Line # 37 |
8 |
0% |
5 |
4 |
0.7333333573.3% |
|---|---|---|---|---|---|---|
| toParametersWithIV(SymmetricCipherParameters) : ParametersWithIV toParametersWithIV(SymmetricCipherParameters) : ParametersWithIV | 3939 | 4.04 | 0.00% | 2.02 | 2.02 | 0.6666667 0.666666766.7% |
| getCipherInstance(boolean,SymmetricCipherParameters) : BlockCipher getCipherInstance(boolean,SymmetricCipherParameters) : BlockCipher | 5252 | 1.01 | 0.00% | 1.01 | 0.00 | 1.0 1.0100% |
| getInstance(boolean,CipherParameters) : SymmetricCipher getInstance(boolean,CipherParameters) : SymmetricCipher | 5858 | 3.03 | 0.00% | 2.02 | 2.02 | 0.6 0.660% |
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA384org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA384 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2BlowfishWithPBKDF2org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2BlowfishWithPBKDF2 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testEncryptDecryptPBES2AESorg.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testEncryptDecryptPBES2AES | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testRC2EffectiveBitsEncriptionorg.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testRC2EffectiveBitsEncription | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA512org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA512 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestAES128org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestAES128 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA256org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA256 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestDesEde3org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestDesEde3 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestBlowfishorg.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestBlowfish | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testEncryptDecryptDefaultorg.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testEncryptDecryptDefault | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA224org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2AESWithHmacSHA224 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testGetCipherPropertiesorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testGetCipherProperties | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestRC2org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestRC2 | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testRC2EffectiveBitsDecriptionorg.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testRC2EffectiveBitsDecription | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestDesorg.xwiki.crypto.password.internal.DefaultPrivateKeyPasswordBasedEncryptorTest.testPBES2ConformanceTestDes | 1PASS | ||
|
0.73333335
|
org.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2BlowfishWithScryptorg.xwiki.crypto.password.internal.pbe.factory.BcPBES2CipherFactoryTest.testPBES2BlowfishWithScrypt | 1PASS | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.6666667
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testCipherWithWrongParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testCipherWithWrongParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcAesCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast5CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcCast6CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcBlowfishCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcDesEdeCbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL | ||
|
0.26666668
|
org.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParametersorg.xwiki.crypto.cipher.internal.symmetric.factory.BcRc2CbcPaddedCipherFactoryTest.testCipherWithAsymmetricParameters | 3FAIL |
| 1 | /* | ||||||
| 2 | * See the NOTICE file distributed with this work for additional | ||||||
| 3 | * information regarding copyright ownership. | ||||||
| 4 | * | ||||||
| 5 | * This is free software; you can redistribute it and/or modify it | ||||||
| 6 | * under the terms of the GNU Lesser General Public License as | ||||||
| 7 | * published by the Free Software Foundation; either version 2.1 of | ||||||
| 8 | * the License, or (at your option) any later version. | ||||||
| 9 | * | ||||||
| 10 | * This software is distributed in the hope that it will be useful, | ||||||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||
| 13 | * Lesser General Public License for more details. | ||||||
| 14 | * | ||||||
| 15 | * You should have received a copy of the GNU Lesser General Public | ||||||
| 16 | * License along with this software; if not, write to the Free | ||||||
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||||||
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||||||
| 19 | */ | ||||||
| 20 | package org.xwiki.crypto.cipher.internal.symmetric.factory; | ||||||
| 21 | |||||||
| 22 | import org.bouncycastle.crypto.BlockCipher; | ||||||
| 23 | import org.bouncycastle.crypto.modes.CBCBlockCipher; | ||||||
| 24 | import org.bouncycastle.crypto.params.ParametersWithIV; | ||||||
| 25 | import org.xwiki.crypto.cipher.SymmetricCipher; | ||||||
| 26 | import org.xwiki.crypto.cipher.internal.symmetric.BcPaddedSymmetricCipher; | ||||||
| 27 | import org.xwiki.crypto.params.cipher.CipherParameters; | ||||||
| 28 | import org.xwiki.crypto.params.cipher.symmetric.KeyWithIVParameters; | ||||||
| 29 | import org.xwiki.crypto.params.cipher.symmetric.SymmetricCipherParameters; | ||||||
| 30 | |||||||
| 31 | /** | ||||||
| 32 | * Abstract base class for a Cipher Factory of CBC padded Bouncy Castle cipher. | ||||||
| 33 | * | ||||||
| 34 | * @version $Id: 8a62c7c954dd9f3846812f5a6dfc60a98ca84a93 $ | ||||||
| 35 | * @since 5.4M1 | ||||||
| 36 | */ | ||||||
|
|||||||
| 37 |
public abstract class AbstractBcCbcPaddedCipherFactory extends AbstractBcSymmetricCipherFactory |
||||||
| 38 | { | ||||||
|
|||||||
| 39 | 50 | private ParametersWithIV toParametersWithIV(SymmetricCipherParameters parameters)... |
|||||
| 40 | { | ||||||
| 41 | 43 | if (!(parameters instanceof KeyWithIVParameters)) { | |||||
| 42 | 0 |
throw new IllegalArgumentException("Invalid parameters for cipher: " + parameters.getClass().getName()); |
|||||
| 43 | } | ||||||
| 44 | 43 | KeyWithIVParameters params = (KeyWithIVParameters) parameters; | |||||
| 45 | |||||||
| 46 | 43 | return new ParametersWithIV( | |||||
| 47 | getBcKeyParameter(params.getKeyParameter()), | ||||||
| 48 | params.getIV() | ||||||
| 49 | ); | ||||||
| 50 | } | ||||||
| 51 | |||||||
|
|||||||
| 52 | 50 | @Override... |
|||||
| 53 | protected BlockCipher getCipherInstance(boolean forEncryption, SymmetricCipherParameters parameters) | ||||||
| 54 | { | ||||||
| 55 | 50 | return new CBCBlockCipher(getEngineInstance()); | |||||
| 56 | } | ||||||
| 57 | |||||||
|
|||||||
| 58 | 57 | @Override... |
|||||
| 59 | public SymmetricCipher getInstance(boolean forEncryption, CipherParameters parameters) | ||||||
| 60 | { | ||||||
| 61 | 50 | if (!(parameters instanceof SymmetricCipherParameters)) { | |||||
| 62 | 0 | throw new IllegalArgumentException("Unexpected parameters received for a symmetric cipher: " | |||||
| 63 |
+ parameters.getClass().getName()); |
||||||
| 64 | } | ||||||
| 65 | 50 | return new BcPaddedSymmetricCipher(getCipherInstance(forEncryption, (SymmetricCipherParameters) parameters), | |||||
| 66 |
forEncryption, toParametersWithIV((SymmetricCipherParameters) parameters)); |
||||||
| 67 | } | ||||||
| 68 | } |
