com.ibm.crypto.fips.provider

Class IdentityDatabase

  1. java.lang.Object
  2. extended byjava.security.Identity
  3. extended byjava.security.IdentityScope
  4. extended bycom.ibm.crypto.fips.provider.IdentityDatabase
All implemented interfaces:
java.io.Serializable, java.security.Principal

  1. public class IdentityDatabase
  2. extends java.security.IdentityScope
  3. implements java.io.Serializable
An implementation of IdentityScope as a persistent identity database.
See Also:
Identity, Key, Serialized Form

Constructor Summary

Constructor and Description
IdentityDatabase(java.io.File file)
Construct a new, empty database with a specified source file.
IdentityDatabase(java.lang.String name)
Construct a new, empty database.

Method Summary

Modifier and Type Method and Description
  1. void
addIdentity(java.security.Identity identity)
Adds an identity to the database.
  1. static
  2. IdentityDatabase
fromFile(java.io.File f)
Initialize an IdentityDatabase from file.
  1. static
  2. IdentityDatabase
fromStream(java.io.InputStream is)
Initialize an identity database from a stream.
  1. java.security.Identity
getIdentity(java.security.PublicKey key)
Get an identity by key.
  1. java.security.Identity
getIdentity(java.lang.String name)
  1. java.util.Enumeration
identities()
  1. void
removeIdentity(java.security.Identity identity)
Removes an identity to the database.
  1. void
save()
Saves the database to the default source file.
  1. void
save(java.io.OutputStream os)
Save the database in its current state to an output stream.
  1. int
size()
  1. java.lang.String
toString()
Methods inherited from class java.security.IdentityScope
getIdentity, getSystemScope, setSystemScope
Methods inherited from class java.security.Identity
addCertificate, certificates, equals, getInfo, getName, getPublicKey, getScope, hashCode, identityEquals, removeCertificate, setInfo, setPublicKey, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

IdentityDatabase

  1. public IdentityDatabase(java.io.File file)
  2. throws java.security.InvalidParameterException
Construct a new, empty database with a specified source file.
Parameters:
file - the source file.
Throws:
java.security.InvalidParameterException

IdentityDatabase

  1. public IdentityDatabase(java.lang.String name)
  2. throws java.security.InvalidParameterException
Construct a new, empty database.
Throws:
java.security.InvalidParameterException

Method Detail

fromStream

  1. public static IdentityDatabase fromStream( java.io.InputStream is)
  2. throws java.io.IOException
Initialize an identity database from a stream. The stream should contain data to initialized a serialized IdentityDatabase object.
Parameters:
is - the input stream from which to restore the database.
Throws:
java.io.IOException - if a stream IO exception occurs

fromFile

  1. public static IdentityDatabase fromFile( java.io.File f)
  2. throws java.io.IOException
Initialize an IdentityDatabase from file.
Parameters:
f - the filename where the identity database is stored.
Throws:
java.io.IOException - a file-related exception occurs (e.g. the directory of the file passed does not exists, etc.

size

  1. public int size()
Specified by:
size in class java.security.IdentityScope
Returns:
the number of identities in the database.

getIdentity

  1. public java.security.Identity getIdentity( java.lang.String name)
Specified by:
getIdentity in class java.security.IdentityScope
Parameters:
name - the name of the identity to be retrieved.
Returns:
the identity named name, or null if there are no identities named name in the database.

getIdentity

  1. public java.security.Identity getIdentity( java.security.PublicKey key)
Get an identity by key.
Specified by:
getIdentity in class java.security.IdentityScope
Returns:
the identity with a given key, or null if there are no identities with that key in the database.

addIdentity

  1. public void addIdentity(java.security.Identity identity)
  2. throws java.security.KeyManagementException
Adds an identity to the database.
Specified by:
addIdentity in class java.security.IdentityScope
Parameters:
identity - the identity to be added.
Throws:
java.security.KeyManagementException - if a name or key clash occurs, or if another exception occurs.

removeIdentity

  1. public void removeIdentity(java.security.Identity identity)
  2. throws java.security.KeyManagementException
Removes an identity to the database.
Specified by:
removeIdentity in class java.security.IdentityScope
Throws:
java.security.KeyManagementException

identities

  1. public java.util.Enumeration identities( )
Specified by:
identities in class java.security.IdentityScope
Returns:
an enumeration of all identities in the database.

save

  1. public void save(java.io.OutputStream os)
  2. throws java.io.IOException
Save the database in its current state to an output stream.
Parameters:
os - the output stream to which the database should be serialized.
Throws:
java.io.IOException - if an IO exception is raised by stream operations.

save

  1. public void save()
  2. throws java.io.IOException
Saves the database to the default source file.
Throws:
java.io.IOException - when there is no default source file specified for this database.

toString

  1. public java.lang.String toString( )
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.security.IdentityScope