File tree 2 files changed +15
-2
lines changed
main/java/org/bouncycastle/jcajce/provider/symmetric/util
test/java/org/bouncycastle/jcajce/provider/test/jasypt
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -448,7 +448,7 @@ else if (modeName.startsWith("PGPCFB"))
448
448
{
449
449
throw new NoSuchAlgorithmException ("no mode support for " + modeName );
450
450
}
451
-
451
+
452
452
ivLength = baseEngine .getBlockSize ();
453
453
cipher = new BufferedGenericBlockCipher (
454
454
new PGPCFBBlockCipher (baseEngine , inlineIV ));
@@ -634,7 +634,7 @@ else if (paddingName.equals("TBCPADDING"))
634
634
protected void engineInit (
635
635
int opmode ,
636
636
Key key ,
637
- AlgorithmParameterSpec params ,
637
+ AlgorithmParameterSpec params ,
638
638
SecureRandom random )
639
639
throws InvalidKeyException , InvalidAlgorithmParameterException
640
640
{
@@ -825,6 +825,10 @@ else if (!(key instanceof RepeatedSecretKeySpec))
825
825
// if (params instanceof PBEParameterSpec)
826
826
// {
827
827
// params = ((PBEParameterSpec)params).getParameterSpec();
828
+ // if (((IvParameterSpec)params).getIV().length == 0)
829
+ // {
830
+ // params = new IvParameterSpec(((ParametersWithIV)param).getIV());
831
+ // }
828
832
// }
829
833
// else
830
834
// {
Original file line number Diff line number Diff line change @@ -14,5 +14,14 @@ public static void main(String[] args)
14
14
15
15
String encryptedText = stringEncryptor .encrypt ("plainText" );
16
16
17
+ StandardPBEStringEncryptor stringdecryptor = new StandardPBEStringEncryptor ();
18
+ stringdecryptor .setAlgorithm ("PBEWITHSHA256AND256BITAES-CBC-BC" );
19
+ stringdecryptor .setPassword ("secretPassword" );
20
+ stringdecryptor .setIvGenerator (new RandomIvGenerator ());
21
+ stringdecryptor .setProvider (new BouncyCastleProvider ());
22
+
23
+ String decryptedText = stringdecryptor .decrypt (encryptedText );
24
+ System .out .println (decryptedText );
25
+
17
26
}
18
27
}
You can’t perform that action at this time.
0 commit comments