-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b28
-
sparc
-
solaris_2.6
-
Verified
Name: ktR10099 Date: 10/17/2003
While calling getObject(Key k, String provider) with valid key and null
string method throws IllegalArgumentException. This behavior contadicts to
the spec, besides, in such situation NullPointerException seems to be more
appropriate. Please find below test example, demonstrating the bug.
----------------------------test127.java--------------------------
import javax.security.auth.kerberos.*;
import javax.crypto.*;
import java.security.*;
public class test127 {
public static void main(String[] args) {
Cipher c = null;
SealedObject so = null;
String provider = null;
char[] passwd = new String("password").toCharArray();
KerberosPrincipal kp = new KerberosPrincipal("###@###.###");
Key k = new KerberosKey(kp, passwd, "DES");
try {
c = Cipher.getInstance("DES");
c.init(Cipher.ENCRYPT_MODE, k);
so = new SealedObject("Test string", c);
} catch (Exception e) {
System.out.println("1. Unexpected exception : " + e);
}
try {
Object o = so.getObject(k, null);
System.out.println("Unsealed object : " + o);
} catch (Exception e) {
System.out.println("2. Unexpected exception : " + e);
}
System.out.println("Finished");
}
}
------------------------------output of test127----------------------
java full version "1.5.0-beta-b23"
2. Unexpected exception : java.lang.IllegalArgumentException: missing provider
Finished
---------------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4947024 incomplete spec for javax.crypto.SecretKeyFactory.getInstance(String, Provider)
- Closed