List the available algorithm names for ciphers, key agreement, macs, message digests and signatures : 供应商 « 安全 « Java

En
Java
1. 图形用户界面
2. 三维图形动画
3. 高级图形
4. 蚂蚁编译
5. Apache类库
6. 统计图
7. 
8. 集合数据结构
9. 数据类型
10. 数据库JDBC
11. 设计模式
12. 开发相关类
13. EJB3
14. 电子邮件
15. 事件
16. 文件输入输出
17. 游戏
18. 泛型
19. GWT
20. Hibernate
21. 本地化
22. J2EE平台
23. 基于J2ME
24. JDK-6
25. JNDI的LDAP
26. JPA
27. JSP技术
28. JSTL
29. 语言基础知识
30. 网络协议
31. PDF格式RTF格式
32. 映射
33. 常规表达式
34. 脚本
35. 安全
36. Servlets
37. Spring
38. Swing组件
39. 图形用户界面
40. SWT-JFace-Eclipse
41. 线程
42. 应用程序
43. Velocity
44. Web服务SOA
45. 可扩展标记语言
Java 教程
Java » 安全 » 供应商屏幕截图 
List the available algorithm names for ciphers, key agreement, macs, message digests and signatures

/*
Ciphers:
            None available.
KeyAgreeents:
            None available.
Macs:
            None available.
MessageDigests:
            SHA-512
            SHA1
            MD2
            SHA
            SHA ImplementedIn
            SHA-256
            MD5 ImplementedIn
            SHA-1
            MD5
            SHA-384
Signatures:
            OID.1.2.840.10040.4.3
            OID.1.2.840.113549.1.1.4
            SHA384withRSA
            1.3.14.3.2.29
            SHA512withRSA SupportedKeyClasses
            SHA/DSA
            SHA1withDSA KeySize
            NONEwithDSA SupportedKeyClasses
            OID.1.2.840.113549.1.1.5
            SHA512withRSA
            MD5withRSA
            DSS
            OID.1.2.840.113549.1.1.11
            SHA384withRSA SupportedKeyClasses
            SHA1withRSA
            MD5withRSA SupportedKeyClasses
            NONEwithDSA
            1.2.840.113549.1.1.4
            MD5andSHA1withRSA
            1.2.840.113549.1.1.11
            OID.1.2.840.113549.1.1.13
            1.3.14.3.2.27
            1.2.840.10040.4.3
            SHA256withRSA
            MD2withRSA SupportedKeyClasses
            1.2.840.113549.1.1.2
            1.2.840.113549.1.1.12
            RawDSA
            SHA1withDSA
            SHA1/DSA
            MD2withRSA
            1.3.14.3.2.13
            SHAwithDSA
            DSAWithSHA1
            1.2.840.113549.1.1.13
            OID.1.3.14.3.2.29
            SHA1withDSA ImplementedIn
            SHA256withRSA SupportedKeyClasses
            SHA1withDSA SupportedKeyClasses
            DSA
            1.2.840.113549.1.1.5
            SHA-1/DSA
            SHA1withRSA SupportedKeyClasses
            OID.1.2.840.113549.1.1.12
            OID.1.2.840.113549.1.1.2
 */
import java.security.Provider;
import java.security.Security;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class ListAlgorithms {
  public static void printSet(String setName, Set algorithms) {
    System.out.println(setName + ":");
    if (algorithms.isEmpty()) {
      System.out.println("            None available.");
    else {
      Iterator it = algorithms.iterator();
      while (it.hasNext()) {
        String name = (Stringit.next();

        System.out.println("            " + name);
      }
    }
  }

  public static void main(String[] args) {
    Provider[] providers = Security.getProviders();
    Set<String> ciphers = new HashSet<String>();
    Set<String> keyAgreements = new HashSet<String>();
    Set<String> macs = new HashSet<String>();
    Set<String> messageDigests = new HashSet<String>();
    Set<String> signatures = new HashSet<String>();

    for (int i = 0; i != providers.length; i++) {
      Iterator it = providers[i].keySet().iterator();

      while (it.hasNext()) {
        String entry = (Stringit.next();

        if (entry.startsWith("Alg.Alias.")) {
          entry = entry.substring("Alg.Alias.".length());
        }

        if (entry.startsWith("Cipher.")) {
          ciphers.add(entry.substring("Cipher.".length()));
        else if (entry.startsWith("KeyAgreement.")) {
          keyAgreements.add(entry.substring("KeyAgreement.".length()));
        else if (entry.startsWith("Mac.")) {
          macs.add(entry.substring("Mac.".length()));
        else if (entry.startsWith("MessageDigest.")) {
          messageDigests.add(entry.substring("MessageDigest.".length()));
        else if (entry.startsWith("Signature.")) {
          signatures.add(entry.substring("Signature.".length()));
        }
      }
    }

    printSet("Ciphers", ciphers);
    printSet("KeyAgreeents", keyAgreements);
    printSet("Macs", macs);
    printSet("MessageDigests", messageDigests);
    printSet("Signatures", signatures);
  }
}

           
       
Related examples in the same category
1. 列出所有供应者及其它的算法
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.