我如何找到验证我的JDK安全提供商的加密实力? [英] How can I find verify the encryption strength of my JDK security Providers?

查看:119
本文介绍了我如何找到验证我的JDK安全提供商的加密实力?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个小程序打印出我的JDK安装中的所有受支持的提供程序,但是我想知道是否有人知道如何更改这个程序,还可以打印出每个提供程序的强度?

I have this little program that prints out all of the supported providers in my JDK installation but I am wondering if anyone knows how I can change this program to also print out the "strength" of each of the Providers?

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());

      } 
    } 
  }

} 


推荐答案

密码.getMaxAllowedKeyLength()

转换转换并返回允许的最高密钥。

Pass in the transformation and it will return the highest allowed key.

这是一个简单的检查

public bool isUnlimitedKeyStrength() {
    return Cipher.getMaxAllowedKeyLength("AES") == Integer.MAX_VALUE;
}

这篇关于我如何找到验证我的JDK安全提供商的加密实力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆