Skip to content

Commit

Permalink
Use AES/GCM/NoPadding
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Sep 1, 2023
1 parent 8a6918f commit cf50e1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jpos/src/main/java/org/jpos/security/SensitiveString.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package org.jpos.security;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.jpos.iso.ISOUtil;

import javax.crypto.*;
Expand All @@ -33,13 +34,15 @@ public class SensitiveString implements Supplier<String>, AutoCloseable {
private SecretKey key;
private byte[] encoded;
private static Random rnd;
private static final String AES = "AES/CBC/PKCS5Padding";
private static final String AES = "AES/GCM/NoPadding";

private static final Cleaner cleaner = Cleaner.create();
private Cleaner.Cleanable cleanable;

static {
rnd = new SecureRandom();
if(Security.getProvider("BC") == null)
Security.addProvider(new BouncyCastleProvider());
}

public SensitiveString(String s) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, NoSuchProviderException, InvalidAlgorithmParameterException {
Expand Down

0 comments on commit cf50e1c

Please sign in to comment.