All Packages Class Hierarchy This Package Previous Next Index
Class semper.certificate.dummy.DummyCertificate
java.lang.Object
|
+----semper.certificate.dummy.DummyCertificate
- public class DummyCertificate
- extends Object
- implements Certificate
This is an implementation of the Certificate interface allowing the initial
SEMPER trials to use certificates.
The certificate stores the following information: distinguished name of CA and user,
a unique serial number, the public key, scope of the key, type of the certificate
(for the moment this is always key-certificate), validity period, status of certificate,
reason for revocation in case the certificated has been revoked, the signature,
algorithm identifiers for signing and hashing.
Services for registration is provided by
a simple
implementation of RCModuleInterface.
- See Also:
- RCModuleInterface
-
DummyCertificate()
- Create an empty certificate
-
DummyCertificate(DummyCertificate)
- Create a new Certificate containing the same info as the input certificate.
-
DummyCertificate(String, String, long, CryptoKeyInfo, Scope, CertificateType, Date, Date, Status, Revocation, byte[], SignAlgorithm, HashingAlgorithm)
- Create a certificate.
-
DummyCertificate(String, String, long, CryptoKeyInfo, Scope, CertificateType, Date, Date, Status, Revocation, byte[], SignAlgorithm, HashingAlgorithm, DummyExtensions)
- Create a certificate.
-
compareTo(Browseable, int, boolean)
-
Compare with given object.
-
copyCertificate(DummyCertificate)
- Method for copying the content of one certificate into another
-
equals(Object)
- Overrides the equals method.
-
exportToLineOfASCII()
-
One line of ASCII.
-
exportToLineOfHTML()
-
One line of HTML.
-
exportToLinesOfHTML()
-
Several lines of HTML.
-
getActions()
- Sets the names of the actions that should be displayed on the TINGUIN.This method
is dynamically invoked by the method interact2 of the Browser class.
-
getCAkey(String)
- Get the secret key of the CA generated by generateCAkeys() in
DummyRCModule.java.
-
getCAName()
- Retrieve CA's name.
-
getCASign()
- Retrieve signature for this certificate signed by the CA whose
Distinguished Name is stored in the Certificate.
-
getExtensions()
-
-
getHashID()
- Get the Algorithm ID (HASH_MD4, HASH_RIPEMD etc) of the function used by
the CA to hash the signatuer of this certificate.
-
getIdLevel()
- Retrieve the identification level of this certificate as a String
-
getKeys()
-
Obtain the names of the keys which can be used to sort.
-
getMethodName(int)
-
Obtain the name of the method that should be called for a browseable.
-
getModuleName()
- Retrieve name of module
-
getName()
- Return the formal name of the Browseable which is Certificate.
-
getNotValidAfter()
- Retrieve the Date after which this certificate isn't valid.
-
getNotValidBefore()
- Retrieve the Date before which this certificate isn't valid.
-
getPublicKey()
- Retrieve certified Public Key.
-
getRegLevel()
- Retrieve the registration level of this certificate as a String
-
getRevokationReason()
- Finds the reason for which the certificate was revoked
-
getScope()
- Retrieve certificate scope.
-
getSerialNo()
- Retrieve Serial number
Certificate static structure means I can retrieve it myself.
-
getSignatureID()
- Get the Algorithm ID (SIG_RSA, SIG_DSS etc) of the function used by the
CA to sign this certificate.
-
getStatus()
- Retrieve status
-
getType()
- retrieve certificate type
-
getUserDN()
- Retrieve users name.
-
getWhyRevoked()
- Retrieve revocation reason
-
isEqual(Certificate)
- Decides whether two certificates should be considered equal.
-
sameCertificate(Certificate)
- The same as isEqual method.
-
setCAName(String)
- Set the CA's name that issued this certificate.
-
setCASign(byte[])
- Set signature for this certificate, signed by the CA whose
Distinguished Name is stored in the Certificate.
-
setExtensions(CertificateExtensions)
-
-
setHashID(HashingAlgorithm)
- Set the algorithm ID of the algorithm used to hash
this Certificate with.
-
setNotValidAfter(Date)
- Set the Date after which this certificate isn't valid.
-
setNotValidBefore(Date)
- Set the Date before which this certificate isn't valid.
-
setPublicKey(CryptoKeyInfo)
- Set the Public Key certified with this certificate.
-
setScope(Scope)
- Set the scope for this Certificate.
-
setSerialNo(long)
- Set this Certificates SerialNo with which it is identified
by the CA that issued this certificate.
-
setSignatureID(SignAlgorithm)
- Set the algorithm ID of the algorithm used to sign
this Certificate with.
-
setStatus(Status)
- Set the status of the Certificate.
-
setType(CertificateType)
- Set the type of Certificate.
-
setUserDN(String)
- Set certificate owners name.
-
setWhyRevoked(Revocation)
- Set reason why this Certificate was revoked.
-
toByteArray()
- Encodes the parts of a certificate to be signed as an array of bytes
-
toString()
-
-
verifyCertificate(CryptoKeyInfo)
- Verify Certificates correctness.
DummyCertificate
public DummyCertificate(String ca,
String user,
long nr,
CryptoKeyInfo pubKey,
Scope scope,
CertificateType type,
Date validStart,
Date validEnd,
Status state,
Revocation reason,
byte signature[],
SignAlgorithm signatureID,
HashingAlgorithm hashID)
- Create a certificate.
- Parameters:
- ca - = Distinguished name of Certification Authority issuing this
certificate
- user - = Distinguished name of User to which certificate belongs.
- nr - = Serial number for certificate within CA
- pubKey - = The public key certified for this User by certificate.
- scope - = Public keys scope (or application)
- type - = Certificate Type
- validStart - = Start of validity period
- validEnd - = End of validity period
- state - = _status of the certificate
- reason - = Reason for revocation
- signature - = CA's signature
- signatureID - = The algorithm ID of the algorithm which is used to sign
this Certificate. The type of hash algorithm should
correspond to the possible algorithm types defined in
the CryptoConstants.
- hashID - = The algorithm ID of the algorithm used to hash this Certificate.
The type of hash algorithm should correspond to the possible
algorithm types defined in the CryptoConstants.
DummyCertificate
public DummyCertificate(String ca,
String user,
long nr,
CryptoKeyInfo pubKey,
Scope scope,
CertificateType type,
Date validStart,
Date validEnd,
Status state,
Revocation reason,
byte signature[],
SignAlgorithm signatureID,
HashingAlgorithm hashID,
DummyExtensions extensions)
- Create a certificate.
- Parameters:
- ca - = Distinguished name of Certification Authority issuing this
certificate
- user - = Distinguished name of User to which certificate belongs.
- nr - = Serial number for certificate within CA
- pubKey - = The public key certified for this User by certificate.
- scope - = Public keys scope (or application)
- type - = Certificate Type
- validStart - = Start of validity period
- validEnd - = End of validity period
- state - = _status of the certificate
- reason - = Reason for revocation
- signature - = CA's signature
- signatureID - = The algorithm ID of the algorithm which is used to sign
this Certificate. The type of hash algorithm should
correspond to the possible algorithm types defined in
the CryptoConstants.
- hashID - = The algorithm ID of the algorithm used to hash this Certificate.
The type of hash algorithm should correspond to the possible
algorithm types defined in the CryptoConstants.
- extensions - =
DummyCertificate
public DummyCertificate()
- Create an empty certificate
DummyCertificate
public DummyCertificate(DummyCertificate cert)
- Create a new Certificate containing the same info as the input certificate.
- Parameters:
- cert - is the certificate which shoiuld be copied.
getModuleName
public String getModuleName()
- Retrieve name of module
- Returns:
- name of module
getCAName
public String getCAName()
- Retrieve CA's name.
Certificate static structure means I can retrieve it myself.
- Returns:
- distinguished name of CA
getUserDN
public String getUserDN()
- Retrieve users name.
Certificate static structure means I can retrieve it myself.
- Returns:
- distinguished name of CA
getRegLevel
public String getRegLevel()
- Retrieve the registration level of this certificate as a String
- Returns:
- registration level
getIdLevel
public String getIdLevel()
- Retrieve the identification level of this certificate as a String
- Returns:
- identification level
getSerialNo
public long getSerialNo()
- Retrieve Serial number
Certificate static structure means I can retrieve it myself.
- Returns:
- serial number of certificate
getPublicKey
public CryptoKeyInfo getPublicKey()
- Retrieve certified Public Key.
- Returns:
- certified public key
getScope
public Scope getScope()
- Retrieve certificate scope.
- Returns:
- scope of certificate
getType
public CertificateType getType()
- retrieve certificate type
- Returns:
- type of certificate
getNotValidBefore
public Date getNotValidBefore()
- Retrieve the Date before which this certificate isn't valid.
- Returns:
- Date before which this certificate isn't valid.
getNotValidAfter
public Date getNotValidAfter()
- Retrieve the Date after which this certificate isn't valid.
- Returns:
- Date after which this certificate isn't valid.
getStatus
public Status getStatus()
- Retrieve status
- Returns:
- status of certificate (may be STATUS_NYI)
getCASign
public byte[] getCASign()
- Retrieve signature for this certificate signed by the CA whose
Distinguished Name is stored in the Certificate.
- Returns:
- the signature as a byte array
getWhyRevoked
public Revocation getWhyRevoked()
- Retrieve revocation reason
- Returns:
- the reason why a certificate has been revoked
getSignatureID
public SignAlgorithm getSignatureID()
- Get the Algorithm ID (SIG_RSA, SIG_DSS etc) of the function used by the
CA to sign this certificate.
- Returns:
- an integer encoding the algorithm used for making the signature
- See Also:
- CryptoConstants
getHashID
public HashingAlgorithm getHashID()
- Get the Algorithm ID (HASH_MD4, HASH_RIPEMD etc) of the function used by
the CA to hash the signatuer of this certificate.
- Returns:
- an integer encoding the algorithm used for hashing the certificate
before signing.
- See Also:
- CryptoConstants
setCAName
public void setCAName(String name)
- Set the CA's name that issued this certificate. This name
is stored in the certificate.
- Parameters:
- : - CA's name.
setUserDN
public void setUserDN(String name)
- Set certificate owners name. This name
is stored in the certificate.
- Parameters:
- : - users name.
setSerialNo
public void setSerialNo(long serialNr)
- Set this Certificates SerialNo with which it is identified
by the CA that issued this certificate. This SerialNo
is stored in the certificate.
- Parameters:
- new - serial number
setPublicKey
public void setPublicKey(CryptoKeyInfo newKey)
- Set the Public Key certified with this certificate.
- Parameters:
- the - new public key in the certificate.
setScope
public void setScope(Scope scope)
- Set the scope for this Certificate.
- Parameters:
- : - scope for the certificate.
setType
public void setType(CertificateType type)
- Set the type of Certificate.
- Parameters:
- type - of certificate.
setNotValidBefore
public void setNotValidBefore(Date notValidBefore)
- Set the Date before which this certificate isn't valid.
- Parameters:
- start - date of certificates validity period.
setNotValidAfter
public void setNotValidAfter(Date notValidAfter)
- Set the Date after which this certificate isn't valid.
- Parameters:
- ending - date of certificates validity period.
setStatus
public void setStatus(Status status)
- Set the status of the Certificate.
- Parameters:
- new - status of certificate.
setCASign
public void setCASign(byte signature[]) throws CertificateException
- Set signature for this certificate, signed by the CA whose
Distinguished Name is stored in the Certificate. This function is only
needed for testing.
- Parameters:
- The - string to be assigned to the signature attribute of the certificate.
- Throws: CertificateException
- is thrown, if the CA's signature couldn't be set.
getCAkey
public CryptoKeyInfo getCAkey(String myName) throws CertificateException
- Get the secret key of the CA generated by generateCAkeys() in
DummyRCModule.java. this function will be removed later.
- Parameters:
- myName - is CA's (my) name.
- Returns:
- s the generated keys for this CA.
- Throws: CertificateException
- if the keys couldn't be retrieved.
setWhyRevoked
public void setWhyRevoked(Revocation whyRevoked)
- Set reason why this Certificate was revoked. Might
change to a string later on.
- Parameters:
- reason - for revocation
setSignatureID
public void setSignatureID(SignAlgorithm signatureID)
- Set the algorithm ID of the algorithm used to sign
this Certificate with. The types should correspond to the possible
types defined in the CryptoConstants class (RSA, DSA etc.)
- Parameters:
- signature - algorithm ID.
- See Also:
- CryptoConstants
setHashID
public void setHashID(HashingAlgorithm hashID)
- Set the algorithm ID of the algorithm used to hash
this Certificate with. The types should correspond to the possible
types defined in the CryptoConstants class (MD2C, MD4, RIPE_MD, SHA etc.)
- Parameters:
- Certificate - which contains hashing ID.
- See Also:
- CryptoConstants
verifyCertificate
public boolean verifyCertificate(CryptoKeyInfo trustedPK) throws CertificateException
- Verify Certificates correctness.
Should verify, whether Certificates Signature is correct.
The Certificate Manager will check whether Certificate is
of correct type, not outdated, etc.
- Parameters:
- trustedPK - is the public key against which the certificate is verified
- Returns:
- s: true if Certificate is signed correctly
false if Signature doesn't match input.
- Throws: CertificateException
- if some error occurred while verifying.
sameCertificate
public boolean sameCertificate(Certificate cert)
- The same as isEqual method. See below!
isEqual
public boolean isEqual(Certificate cert)
- Decides whether two certificates should be considered equal.
This module linearises the two certificates and compares the two
byte arrays.
- Parameters:
- The - certificate to be compared against.
- Returns:
- true if the given certificate equals this certificate
setExtensions
public void setExtensions(CertificateExtensions ext)
getExtensions
public CertificateExtensions getExtensions()
copyCertificate
public void copyCertificate(DummyCertificate cert)
- Method for copying the content of one certificate into another
- Parameters:
- the - certificate whose attributes should be copied.
toByteArray
public byte[] toByteArray()
- Encodes the parts of a certificate to be signed as an array of bytes
- Returns:
- array of bytes encoding the Certificate
toString
public String toString()
- Overrides:
- toString in class Object
getName
public String getName()
- Return the formal name of the Browseable which is Certificate.
- Returns:
- the formal name.
- See Also:
- Browseable
exportToLineOfHTML
public String exportToLineOfHTML()
- One line of HTML.
- Returns:
- major information about a certificate in HTML mode
- See Also:
- Browseable
exportToLinesOfHTML
public String exportToLinesOfHTML()
- Several lines of HTML.
- Returns:
- detailed information about a certificate in HTML mode
- See Also:
- Browseable
getRevokationReason
public String getRevokationReason()
- Finds the reason for which the certificate was revoked
- Returns:
- the revokation reason
exportToLineOfASCII
public String exportToLineOfASCII()
- One line of ASCII.
- Returns:
- the certificate in ASCII mode
- See Also:
- Browseable
compareTo
public int compareTo(Browseable other,
int keyno,
boolean reverse)
- Compare with given object.
- Returns:
- an integer that shows which should be displayed first
- See Also:
- compareTo
getKeys
public String[] getKeys()
- Obtain the names of the keys which can be used to sort.
- Returns:
- the names of the keys
- See Also:
- getKeys
getActions
public String[] getActions()
- Sets the names of the actions that should be displayed on the TINGUIN.This method
is dynamically invoked by the method interact2 of the Browser class.
- Returns:
- a table containing the names of the actions.
getMethodName
public String getMethodName(int n)
- Obtain the name of the method that should be called for a browseable.
- Parameters:
- n - specifies the method chosen.
- Returns:
- the name of the method.
equals
public boolean equals(Object obj)
- Overrides the equals method.
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index