File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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"))
448448 {
449449 throw new NoSuchAlgorithmException ("no mode support for " + modeName );
450450 }
451-
451+
452452 ivLength = baseEngine .getBlockSize ();
453453 cipher = new BufferedGenericBlockCipher (
454454 new PGPCFBBlockCipher (baseEngine , inlineIV ));
@@ -634,7 +634,7 @@ else if (paddingName.equals("TBCPADDING"))
634634 protected void engineInit (
635635 int opmode ,
636636 Key key ,
637- AlgorithmParameterSpec params ,
637+ AlgorithmParameterSpec params ,
638638 SecureRandom random )
639639 throws InvalidKeyException , InvalidAlgorithmParameterException
640640 {
@@ -825,6 +825,10 @@ else if (!(key instanceof RepeatedSecretKeySpec))
825825// if (params instanceof PBEParameterSpec)
826826// {
827827// params = ((PBEParameterSpec)params).getParameterSpec();
828+ // if (((IvParameterSpec)params).getIV().length == 0)
829+ // {
830+ // params = new IvParameterSpec(((ParametersWithIV)param).getIV());
831+ // }
828832// }
829833// else
830834// {
Original file line number Diff line number Diff line change @@ -14,5 +14,14 @@ public static void main(String[] args)
1414
1515 String encryptedText = stringEncryptor .encrypt ("plainText" );
1616
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+
1726 }
1827}
You can’t perform that action at this time.
0 commit comments