JCE algorithms in Browser : Algorithms « Security « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » Security » AlgorithmsScreenshots 
JCE algorithms in Browser
JCE algorithms in Browser
 
import java.awt.Dimension;
import java.security.Provider;
import java.security.Security;
import java.util.HashSet;
import java.util.Set;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;

public class ListAlgorithmsBC extends JFrame {
  private void getNodes(DefaultMutableTreeNode providerNode, Provider provider,
      Set<Provider.Service> used, String title, String target) {
    DefaultMutableTreeNode node = new DefaultMutableTreeNode(title);
    for (Provider.Service service : provider.getServices()) {
      if (!used.contains(service&& target.equalsIgnoreCase(service.getType())) {
        used.add(service);
        DefaultMutableTreeNode algNode = new DefaultMutableTreeNode(service.getAlgorithm());
        node.add(algNode);
        algNode.add(new DefaultMutableTreeNode("class : " + service.getClassName()));
      }
    }
    if (node.getChildCount() != 0) {
      providerNode.add(node);
    }
  }

  private ListAlgorithmsBC() {
    super("JCE Algorithms");
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    DefaultMutableTreeNode root = new DefaultMutableTreeNode("Providers");
    DefaultTreeModel treeModel = new DefaultTreeModel(root);
    for (Provider provider : java.security.Security.getProviders()) {
      DefaultMutableTreeNode providerNode = new DefaultMutableTreeNode(provider);
      root.add(providerNode);
      Set<Provider.Service> used = new HashSet<Provider.Service>();

      getNodes(providerNode, provider, used, "Cipher""cipher");
      getNodes(providerNode, provider, used, "Key Agreement""keyagreement");
      getNodes(providerNode, provider, used, "Key Generator""keygenerator");
      getNodes(providerNode, provider, used, "Key Pair Generator""keypairgenerator");
      getNodes(providerNode, provider, used, "Key Factory""keyfactory");
      getNodes(providerNode, provider, used, "Secret Key Factory""secretkeyfactory");
      getNodes(providerNode, provider, used, "Mac""mac");
      getNodes(providerNode, provider, used, "Message Digest""messagedigest");
      getNodes(providerNode, provider, used, "Signature""signature");
      getNodes(providerNode, provider, used, "Algorithm Paramater""algorithmparameters");
      getNodes(providerNode, provider, used, "Algorithm Paramater Generator",
          "algorithmparametergenerator");
      getNodes(providerNode, provider, used, "Key Store""keystore");
      getNodes(providerNode, provider, used, "Secure Random""securerandom");
      getNodes(providerNode, provider, used, "Certificate Factory""certificatefactory");
      getNodes(providerNode, provider, used, "Certificate Store""certstore");
      getNodes(providerNode, provider, used, "Key Manager Factory""KeyManagerFactory");
      getNodes(providerNode, provider, used, "Trust Manager Factory""TrustManagerFactory");
      getNodes(providerNode, provider, used, "SSL Context""SSLContext");
      getNodes(providerNode, provider, used, "Sasl Server Factory""SaslServerFactory");
      getNodes(providerNode, provider, used, "Sasl Client Factory""SaslClientFactory");
      {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode("Other");
        for (Provider.Service service : provider.getServices()) {
          if (!used.contains(service)) {
            DefaultMutableTreeNode serviceNode = new DefaultMutableTreeNode(service.getType()
                " : " + service.getAlgorithm());
            node.add(serviceNode);
            serviceNode.add(new DefaultMutableTreeNode("class : " + service.getClassName()));
          }
        }
        if (node.getChildCount() != 0)
          providerNode.add(node);
      }
    }

    JTree tree = new JTree(treeModel);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setEditable(false);
    JScrollPane pane = new JScrollPane(tree);
    pane.setPreferredSize(new Dimension(200200));

    getContentPane().add(pane);

    pack();
  }

  public static void main(String[] args) {
    Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
    new ListAlgorithmsBC().setVisible(true);
  }
}

           
         
  
Related examples in the same category
1. What is in bouncycastle (bouncy castle)
2. Listing All Available Cryptographic Services
3. Return the available implementations for a service type
4. Get cryptographic security providers
5. Generating a Parameter Set for the Diffie-Hellman Key Agreement Algorithm
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.