RE350 RE350 - 8 months ago 90
Java Question

Cannot find any provider supporting AES/GCM/NoPadding

We are trying to do encryption supporting AES/GCM/NoPadding in java 7 getting below exception.

Cannot find any provider supporting AES/GCM/NoPadding

Code sample for generating cipher instance is below.

SecretKeySpec eks = new SecretKeySpec(k, "AES");
Cipher c = Cipher.getInstance("AES/GCM/NoPadding");
c.init(Cipher.ENCRYPT_MODE, eks, new GCMParameterSpec(128, iv));


This cipher is not supported by Java SE (exception for Solaris).

public static void main(String[] args) throws Exception {
    for (Provider provider : Security.getProviders()) {
        for (Map.Entry<Object, Object> entry : provider.entrySet()) {
            if (((String) entry.getValue()).contains("GCM")) {
                System.out.printf("key: [%s]  value: [%s]%n",

You might have a look at Bouncy Castle as service provider in that case.

Small snippet for using Bouncycastle.

  1. download bcprov-jdk15on-154.jar from
  2. register the service provider in your code

    Security.addProvider(new BouncyCastleProvider());
  3. then you are able to use the cipher as

    Cipher c = Cipher.getInstance("AES/GCM/NOPADDING", "BC");