Topic
No replies
JulienBonhomme
JulienBonhomme
1 Post
ACCEPTED ANSWER

Pinned topic getAlgorithm() function returns OID instead of name

‏2011-01-13T00:24:46Z |
The following source code doesn't give the same result in Java5 and Java6:

public static int type(MessageDigest digest) {
String name = digest.getAlgorithm();
Provider provider = digest.getProvider();
System.out.println(" --- Debug: getAlgorithm returns name: " + name);
System.out.println(" --- Debug: getProvider returns provider: " + provider.getInfo());
In Java6, this function returns the OId instead of the name.

Java 6 returns:
--- Debug: getAlgorithm returns name: 1.3.14.3.2.26
--- Debug: getProvider returns provider: BouncyCastle Security Provider v1.45

java version "1.6.0"
Java(TM) SE Runtime Environment (build pwi3260sr2-20080818_01(SR2))
IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Windows XP x86-32 jvmwi3260-20080816_22093 (JIT enabled, AOT enabled)
J9VM - 20080816_022093_lHdSMr
JIT - r9_20080721_1330ifx2
GC - 20080724_AA)
JCL - 20080808_02
Java 5 returns:
--- Debug: getAlgorithm returns name: SHA-1
--- Debug: getProvider returns provider: BouncyCastle Security Provider v1.45

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build pwi32dev-20060511 (SR2))
IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20060504 (JIT enabled)
J9VM - 20060501_06428_lHdSMR
JIT - 20060428_1800_r8
GC - 20060501_AA)
JCL - 20060511a

Do you know why this function changed between the two Java release?