Java – how do I find and verify the encryption strength of the JDK security provider?

I have this applet that prints out all supported providers in my JDK installation, but I wonder if anyone knows how to change this program to print out the "strength" of each provider?

import java.security.Provider; 
import java.security.Security; 

public class SecurityListings 
{ 
  public static void main(String[] args) 
  { 
    for (Provider provider : Security.getProviders()) 
    { 
      System.out.println("Provider: " + provider.getName()); 
      for (Provider.Service service : provider.getServices()) 
      { 
        System.out.println(" Algorithm: " + service.getAlgorithm());

      } 
    } 
  }

}

Solution

Cipher. getMaxAllowedKeyLength()

Pass the transformation, which will return the highest allowed key

This is a simple check

public bool isUnlimitedKeyStrength() {
    return Cipher.getMaxAllowedKeyLength("AES") == Integer.MAX_VALUE;
}
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>