Date: Tue, 05 Aug 1997 17:14:20 -0700
From: Ashutosh Apte <ashutosh@titan.ltindia.com>
To: java-security@web2.javasoft.com
Subject: java security
Hi ,
I'm presently working on a internet security project using jdk 1.1.3
and jce package.
I'm facing some problem in accessing the private key of the signer
stored in the default scope
Scope: sun.security.IdentityDatabase,
The abstract class Signer provided in java.security package has a method
getPrivateKey() which returns an object PrivateKey . The following
reproduced may help you to understand the problem
public class Ssigner extends Signer {
public Ssigner(String name,IdentityScope scope) throws
KeyManagementException {
super(name, scope);
}
try {
sign = new Ssigner("ashutosh",IdentityScope.getSystemScope());
} catch(KeyManagementException e ) {
System.out.println( e);
}
IdentityScope Iscope = sign.getScope();
Identity I = Iscope.getIdentity("ashutosh");
PublicKey pub = I.getPublicKey();
// here the public key associated with the signer "ashutosh" is returned
but the private key is not returned and gives
java.lang.NullPointerException:
PrivateKey priv = sign.getPrivateKey();
I would be greatful to get your help on this topic
Thanx .........
Ashutosh Apte