Methods Summary |
---|
public void | addIdentity(java.security.Identity identity)
String name = identity.getName();
if (getIdentity(name) != null)
throw new KeyManagementException(name + " already in identity scope");
PublicKey k = identity.getPublicKey();
if (getIdentity(k) != null)
throw new KeyManagementException(name + " already in identity scope");
ids.put(name, identity);
|
public java.security.Identity | getIdentity(java.lang.String name)
Identity id;
id = (Identity) ids.get(name);
return id;
|
public java.security.Identity | getIdentity(java.security.PublicKey key)
if (key == null)
return null;
Identity id;
for (Enumeration e = ids.elements(); e.hasMoreElements(); ) {
id = (Identity) e.nextElement();
PublicKey k = id.getPublicKey();
if (k != null && k.equals(key))
return id;
}
return null;
|
public java.util.Enumeration | identities()
return ids.elements();
|
public void | removeIdentity(java.security.Identity identity)
String name = identity.getName();
if (ids.get(name) == null)
throw new KeyManagementException(name + " isn't in the identity scope");
ids.remove(name);
|
public void | save()
try {
FileOutputStream fos = new FileOutputStream(fname);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(ids);
} catch (Exception e) {
System.out.println(e);
throw new RuntimeException("Can't save id database");
}
|
public int | size()
return ids.size();
|