[
http://jira.jboss.com/jira/browse/JBAS-3400?page=all ]
Anil Saldhana closed JBAS-3400.
-------------------------------
Resolution: Done
The JAASSecurityManagerService has an operation called as
"displayJCAInformation" that shows something like:
===========
JCA Providers=Providers=SUN version 1.5;SunRsaSign version 1.5;SunJSSE version 1.5;SunJCE
version 1.5;SunJGSS version 1.0;SunSASL version 1.5;JCA
Service/Algorithms=Cipher#algorithms=13[ARCFOUR;PBEWITHSHA1ANDDESEDE;DESEDEWRAP;PBEWITHMD5ANDTRIPLEDES;DESEDE;
RSA;AESWRAP;AES;PBEWITHMD5ANDDES;BLOWFISH;DES;RC2;PBEWITHSHA1ANDRC2_40;]Signature#algorithms=9[SHA256WITHRSA;NONEWITHDSA;
SHA384WITHRSA;MD2WITHRSA;MD5ANDSHA1WITHRSA;SHA512WITHRSA;SHA1WITHRSA;SHA1WITHDSA;MD5WITHRSA;]
KeyFactory#algorithms=3[RSA;DIFFIEHELLMAN;DSA;]SecretKeyFactory#algorithms=8[PBEWITHSHA1ANDDESEDE;PBEWITHMD5ANDTRIPLEDES;DESEDE;
PBEWITHMD5ANDDES;PBKDF2WITHHMACSHA1;PBEWITHSHA1 etc
===========
The display is all one one line. Do not want to use System.getProperty to get the line
delimiter nor any privileged actions just for getting the sys prop.
JaasSecurityManagerService can show security provider/JCA algorithm
information
-------------------------------------------------------------------------------
Key: JBAS-3400
URL:
http://jira.jboss.com/jira/browse/JBAS-3400
Project: JBoss Application Server
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: Security
Affects Versions: JBossAS-4.0.4.GA
Reporter: Anil Saldhana
Assigned To: Anil Saldhana
Priority: Optional
Fix For: JBossAS-4.2.0.GA
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
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira