Class KeyRecord

  • All Implemented Interfaces:
    IAttrSet, com.netscape.certsrv.dbs.IDBObj, com.netscape.certsrv.dbs.keydb.IKeyRecord, java.io.Serializable

    public class KeyRecord
    extends java.lang.Object
    implements com.netscape.certsrv.dbs.keydb.IKeyRecord
    A class represents a Key record. It maintains the key life cycle as well as other information about an archived key. Namely, whether a key is inactive because of compromise.

    Version:
    $Revision$, $Date$
    Author:
    thomask
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.util.Vector<java.lang.String> mNames  
      • Fields inherited from interface com.netscape.certsrv.dbs.keydb.IKeyRecord

        ATTR_ALGORITHM, ATTR_ARCHIVED_BY, ATTR_CLIENT_ID, ATTR_CREATE_TIME, ATTR_DATA_TYPE, ATTR_DATE_OF_RECOVERY, ATTR_ID, ATTR_KEY_SIZE, ATTR_META_INFO, ATTR_MODIFY_TIME, ATTR_OWNER_NAME, ATTR_PRIVATE_KEY_DATA, ATTR_PUBLIC_KEY_DATA, ATTR_REALM, ATTR_STATE, ATTR_STATUS, STATUS_ANY, STATUS_INVALID, STATUS_VALID
    • Constructor Summary

      Constructors 
      Constructor Description
      KeyRecord()
      Constructs empty key record.
      KeyRecord​(java.math.BigInteger serialNo, byte[] publicData, byte[] privateData, java.lang.String owner, java.lang.String algorithm, java.lang.String agentId)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(java.lang.String name)
      Deletes an attribute.
      java.lang.Object get​(java.lang.String name)
      Retrieves an attribute.
      java.lang.String getAlgorithm()
      Retrieves algorithm of the key pair.
      java.lang.String getArchivedBy()
      Retrieves the uid of person who archived this record.
      java.lang.String getClientId()
      Retrieves the client ID of this record.
      java.util.Date getCreateTime()
      Retrieves the creation time of this record.
      java.lang.String getDataType()
      Retrieves the key data type of this record.
      java.util.Date[] getDateOfRevocation()
      Retrieves the date(s) of revocation.
      java.util.Enumeration<java.lang.String> getElements()
      Retrieves an enumeration of attributes.
      java.lang.Integer getKeySize()
      Retrieves the key size.
      java.lang.String getKeyStatus()
      Retrieves the key status of this record.
      MetaInfo getMetaInfo()
      Retrieves the metaInfo.
      java.util.Date getModifyTime()
      Retrieves the last modification time of this record.
      java.lang.String getOwnerName()
      Retrieves owner name.
      byte[] getPrivateKeyData()
      Retrieves key.
      byte[] getPublicKeyData()
      Retrieves the public key.
      java.lang.String getRealm()
      Retrieves authorization realm.
      java.util.Enumeration<java.lang.String> getSerializableAttrNames()
      Retrieves serializable attribute names.
      java.math.BigInteger getSerialNumber()
      Retrieves serial number of the key record.
      com.netscape.certsrv.dbs.keydb.KeyState getState()
      Retrieves the key state.
      org.mozilla.jss.netscape.security.util.WrappingParams getWrappingParams​(org.mozilla.jss.netscape.security.util.WrappingParams oldParams)  
      java.lang.Boolean isEncrypted()  
      void set​(java.lang.String name, java.lang.Object object)
      Sets an attribute.
      void setDateOfRevocation​(java.util.Date[] dates)
      Sets the date of revocation.
      void setKeySize​(java.lang.Integer keySize)
      Sets key size.
      void setOwnerName​(java.lang.String name)
      Sets owner name.
      void setPrivateKeyData​(byte[] keydata)
      Sets key data.
      void setPublicKeyData​(byte[] key)
      Sets the public key.
      void setSerialNumber​(java.math.BigInteger serialno)
      Sets serial number.
      void setState​(com.netscape.certsrv.dbs.keydb.KeyState state)
      Sets key state.
      void setWrappingParams​(org.mozilla.jss.netscape.security.util.WrappingParams params, boolean doEncrypt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mNames

        protected static java.util.Vector<java.lang.String> mNames
    • Constructor Detail

      • KeyRecord

        public KeyRecord()
        Constructs empty key record.
      • KeyRecord

        public KeyRecord​(java.math.BigInteger serialNo,
                         byte[] publicData,
                         byte[] privateData,
                         java.lang.String owner,
                         java.lang.String algorithm,
                         java.lang.String agentId)
                  throws EBaseException
        Throws:
        EBaseException
    • Method Detail

      • set

        public void set​(java.lang.String name,
                        java.lang.Object object)
                 throws EBaseException
        Sets an attribute.

        Specified by:
        set in interface IAttrSet
        Parameters:
        name - the name of the attribute
        object - the attribute object.
        Throws:
        EBaseException - on attribute handling errors.
      • get

        public java.lang.Object get​(java.lang.String name)
                             throws EBaseException
        Retrieves an attribute.

        Specified by:
        get in interface IAttrSet
        Parameters:
        name - the name of the attribute to return.
        Throws:
        EBaseException - on attribute handling errors.
      • delete

        public void delete​(java.lang.String name)
                    throws EBaseException
        Deletes an attribute.

        Specified by:
        delete in interface IAttrSet
        Parameters:
        name - the name of the attribute to delete.
        Throws:
        EBaseException - on attribute handling errors.
      • getElements

        public java.util.Enumeration<java.lang.String> getElements()
        Retrieves an enumeration of attributes.

        Specified by:
        getElements in interface IAttrSet
        Returns:
        an enumeration of the attribute names.
      • getSerializableAttrNames

        public java.util.Enumeration<java.lang.String> getSerializableAttrNames()
        Retrieves serializable attribute names.
        Specified by:
        getSerializableAttrNames in interface com.netscape.certsrv.dbs.IDBObj
        Returns:
        a list of serializable attribute names
      • getSerialNumber

        public java.math.BigInteger getSerialNumber()
                                             throws EBaseException
        Retrieves serial number of the key record. Each key record is uniquely identified by serial number.

        Specified by:
        getSerialNumber in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        serial number of this key record
        Throws:
        EBaseException - failed to retrieve key id
      • setSerialNumber

        public void setSerialNumber​(java.math.BigInteger serialno)
                             throws EBaseException
        Sets serial number.
        Throws:
        EBaseException
      • getState

        public com.netscape.certsrv.dbs.keydb.KeyState getState()
                                                         throws EBaseException
        Retrieves the key state. This gives key life cycle information.

        Specified by:
        getState in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        key state
        Throws:
        EBaseException - failed to retrieve state of the key
      • setState

        public void setState​(com.netscape.certsrv.dbs.keydb.KeyState state)
                      throws EBaseException
        Sets key state.

        Throws:
        EBaseException
      • getArchivedBy

        public java.lang.String getArchivedBy()
        Retrieves the uid of person who archived this record.
        Specified by:
        getArchivedBy in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        archiver uid
      • getKeySize

        public java.lang.Integer getKeySize()
                                     throws EBaseException
        Retrieves the key size.

        Specified by:
        getKeySize in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        key size
        Throws:
        EBaseException - failed to retrieve key length
      • getMetaInfo

        public MetaInfo getMetaInfo()
        Retrieves the metaInfo.

        Specified by:
        getMetaInfo in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        metaInfo
      • getOwnerName

        public java.lang.String getOwnerName()
                                      throws EBaseException
        Retrieves owner name.

        Specified by:
        getOwnerName in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        key owner name
        Throws:
        EBaseException - failed to retrieve key owner name
      • getPublicKeyData

        public byte[] getPublicKeyData()
                                throws EBaseException
        Retrieves the public key.

        Specified by:
        getPublicKeyData in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        public key data
        Throws:
        EBaseException - failed to retrieve public key data
      • getDateOfRevocation

        public java.util.Date[] getDateOfRevocation()
                                             throws EBaseException
        Retrieves the date(s) of revocation.

        Specified by:
        getDateOfRevocation in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        recovery history
        Throws:
        EBaseException - failed to retrieve recovery history
      • setDateOfRevocation

        public void setDateOfRevocation​(java.util.Date[] dates)
                                 throws EBaseException
        Sets the date of revocation.

        Throws:
        EBaseException
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Retrieves algorithm of the key pair.
        Specified by:
        getAlgorithm in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        key algorithm
      • getCreateTime

        public java.util.Date getCreateTime()
        Retrieves the creation time of this record.
        Specified by:
        getCreateTime in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        creation time
      • getModifyTime

        public java.util.Date getModifyTime()
        Retrieves the last modification time of this record.
        Specified by:
        getModifyTime in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        modification time
      • getClientId

        public java.lang.String getClientId()
                                     throws EBaseException
        Retrieves the client ID of this record.
        Specified by:
        getClientId in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        client id
        Throws:
        EBaseException - failed to retrieve client id
      • getKeyStatus

        public java.lang.String getKeyStatus()
                                      throws EBaseException
        Retrieves the key status of this record.
        Specified by:
        getKeyStatus in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        key status
        Throws:
        EBaseException - failed to retrieve key status
      • getDataType

        public java.lang.String getDataType()
                                     throws EBaseException
        Retrieves the key data type of this record.
        Specified by:
        getDataType in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        data type
        Throws:
        EBaseException - failed to retrieve data type
      • getRealm

        public java.lang.String getRealm()
                                  throws EBaseException
        Description copied from interface: com.netscape.certsrv.dbs.keydb.IKeyRecord
        Retrieves authorization realm.
        Specified by:
        getRealm in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Returns:
        authorization realm
        Throws:
        EBaseException - failed to retrieve authorization realm
      • setWrappingParams

        public void setWrappingParams​(org.mozilla.jss.netscape.security.util.WrappingParams params,
                                      boolean doEncrypt)
                               throws java.lang.Exception
        Specified by:
        setWrappingParams in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Throws:
        java.lang.Exception
      • getWrappingParams

        public org.mozilla.jss.netscape.security.util.WrappingParams getWrappingParams​(org.mozilla.jss.netscape.security.util.WrappingParams oldParams)
                                                                                throws java.lang.Exception
        Specified by:
        getWrappingParams in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Throws:
        java.lang.Exception
      • isEncrypted

        public java.lang.Boolean isEncrypted()
                                      throws EBaseException
        Specified by:
        isEncrypted in interface com.netscape.certsrv.dbs.keydb.IKeyRecord
        Throws:
        EBaseException