01: /*************************************************************************
02: * *
03: * EJBCA: The OpenSource Certificate Authority *
04: * *
05: * This software is free software; you can redistribute it and/or *
06: * modify it under the terms of the GNU Lesser General Public *
07: * License as published by the Free Software Foundation; either *
08: * version 2.1 of the License, or any later version. *
09: * *
10: * See terms of license at gnu.org. *
11: * *
12: *************************************************************************/package org.ejbca.core.model.protect;
13:
14: import java.io.UnsupportedEncodingException;
15: import java.security.NoSuchAlgorithmException;
16: import java.security.NoSuchProviderException;
17:
18: /**
19: *
20: * @author tomas
21: * @version $Id: Protectable.java,v 1.1 2006/08/05 09:59:38 anatom Exp $
22: */
23: public interface Protectable {
24:
25: /** Creates and returns the hash code created from the object, the version
26: * parameter can be used to handle upgrades to the class, since the hash must
27: * always be the same, even if this method is caled one year later.
28: *
29: * @param dataVersion version of class/hash requested.
30: * @return String hash value
31: */
32: public String getHash(int hashVersion)
33: throws NoSuchAlgorithmException, NoSuchProviderException,
34: UnsupportedEncodingException;
35:
36: /** The same as above, but returns the hash value for the current version of the object
37: *
38: * @return hash value
39: */
40: public String getHash() throws NoSuchAlgorithmException,
41: NoSuchProviderException, UnsupportedEncodingException;
42:
43: public int getHashVersion();
44:
45: /** Returns the String form of the primary key for the database table that
46: * this object is stored in.
47: *
48: * @return String Stringform of primary database key, used as key in the protection database table.
49: */
50: public String getDbKeyString();
51:
52: /** Returns a unique type string for these kinds of objects, for example LOGENTRY.
53: *
54: * @return String can be anything, as long as it is always the same.
55: */
56: public String getEntryType();
57: }
|