Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3400

JaasSecurityManagerService can show security provider/JCA algorithm information

    XMLWordPrintable

Details

    • Low
    • 0
    • 0% 0%

    Description

      It may be useful to determine the security providers and the various JCA algorithms installed in the JDK.

      So, add two methods to the JaasSecurityManagerService as follows:

      • showProviders()
      • getAlgorithm(String serviceName)

      If the serviceName is null, show all the possible JCA service names.

      Here is a partial tested code, that you may want to adapt:
      ======================================================================================
      import java.security.*;
      import java.util.*;

      public class A
      {
      public static void main(String[] args)
      {
      Provider[] providers = Security.getProviders();
      for(int i = 0; i < providers.length; i++)

      { System.out.println("Provider="+providers[i].toString()); }

      System.out.println("Printing JCA Algorithm Information");
      printJCAAlgorithm("Cipher");
      printJCAAlgorithm("Signature");
      printJCAAlgorithm("KeyFactory");
      printJCAAlgorithm("SecretKeyFactory");
      printJCAAlgorithm("AlgorithmParameters");
      printJCAAlgorithm("MessageDigest");
      printJCAAlgorithm("Mac");
      }

      private static void printJCAAlgorithm(String sName)
      {
      System.out.println("Printing "+sName);
      Set md2 = Security.getAlgorithms(sName);
      System.out.println(sName + " set length="+md2.size());
      Iterator md2iter = md2.iterator();
      while(md2iter.hasNext())

      { System.out.println(md2iter.next().toString()); }

      }
      }
      ====================================================================================

      The output is:
      asaldhana~/testSecurity>java -cp . -Djava.security.manager A
      Provider=SUN version 1.5
      Provider=SunRsaSign version 1.5
      Provider=SunJSSE version 1.5
      Provider=SunJCE version 1.5
      Provider=SunJGSS version 1.0
      Provider=SunSASL version 1.5
      Printing JCA Algorithm Information
      Printing Cipher
      Cipher set length=13
      ARCFOUR
      PBEWITHSHA1ANDDESEDE
      DESEDEWRAP
      PBEWITHMD5ANDTRIPLEDES
      DESEDE
      RSA
      AESWRAP
      AES
      PBEWITHMD5ANDDES
      BLOWFISH
      DES
      RC2
      PBEWITHSHA1ANDRC2_40
      Printing Signature
      Signature set length=9
      SHA256WITHRSA
      NONEWITHDSA
      ....

      Make the changes in HEAD. I will port it to Branch_4_0 and Branch_3_2

      Attachments

        Issue Links

          Activity

            People

              anil.saldhana Anil Saldanha (Inactive)
              anil.saldhana Anil Saldanha (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: