Agent System POND 1.0 (1.7.2000)

PkgAgentSystem.Crypto
Class PublicKeyCertificate

java.lang.Object
  |
  +--java.security.cert.Certificate
        |
        +--PkgAgentSystem.Crypto.PublicKeyCertificate

final class PublicKeyCertificate
extends Certificate

Stores a public key with its name in a certificate.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Field Summary
protected  String name
          The name of the public key
protected  PublicKey publicKey
          The public key
 
Constructor Summary
(package private) PublicKeyCertificate()
          Empty constructor necessary for the factory.
  PublicKeyCertificate(String name, PublicKey publicKey)
          Creates a new certificate with a name and a public key
 
Method Summary
 boolean equals(Object other)
          Indicates whether some other object is "equal to" this one.
 byte[] getEncoded()
          Returns the certificate in an encoded form in an byte array.
 String getName()
          Returns the name of the public key
 PublicKey getPublicKey()
          Returns the public key
 int hashCode()
          Returns a hashcode value for this certificate.
 boolean sign(String signAlgoOwner, PrivateKey privateOwnerKey, String signAlgoAgent, PrivateKey privateAgentKey)
          Does nothing (always unsigned).
 String toString()
          Returns a String representation of this public key.
 void verify(PublicKey ownerKey)
          Does nothing (always ok).
 void verify(PublicKey ownerKey, String sigProvider)
          Does nothing (always ok).
 
Methods inherited from class java.security.cert.Certificate
getType
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected String name
The name of the public key

publicKey

protected transient PublicKey publicKey
The public key
Constructor Detail

PublicKeyCertificate

PublicKeyCertificate()
Empty constructor necessary for the factory.

PublicKeyCertificate

public PublicKeyCertificate(String name,
                            PublicKey publicKey)
Creates a new certificate with a name and a public key
Parameters:
name - the name of the public key
publicKey - the public key
Method Detail

getEncoded

public final byte[] getEncoded()
                        throws CertificateEncodingException
Returns the certificate in an encoded form in an byte array.
Returns:
the array of bytes with the encoded certificate
Throws:
CertificateEncodingException - if an error occured during encoding
Overrides:
getEncoded in class Certificate

sign

public final boolean sign(String signAlgoOwner,
                          PrivateKey privateOwnerKey,
                          String signAlgoAgent,
                          PrivateKey privateAgentKey)
                   throws CertificateEncodingException,
                          InvalidKeyException,
                          NoSuchAlgorithmException,
                          SignatureException
Does nothing (always unsigned).
Parameters:
signAlgoOwner - algorithm used for signing with the owners private key
privateOwnerKey - private key of the owner
signAlgoAgent - algorithm used for signing with the agents private key
privateAgentKey - private key of the agent
Returns:
true if successful

verify

public final void verify(PublicKey ownerKey,
                         String sigProvider)
                  throws CertificateEncodingException,
                         NoSuchAlgorithmException,
                         InvalidKeyException,
                         NoSuchProviderException,
                         SignatureException
Does nothing (always ok).
Parameters:
ownerKey - public key of the owner used for verification of the signature
sigProvider - name of the security provider which should be used for verification (take care that it is installed). If null, the default provider is used
Overrides:
verify in class Certificate

verify

public final void verify(PublicKey ownerKey)
                  throws CertificateEncodingException,
                         NoSuchAlgorithmException,
                         InvalidKeyException,
                         SignatureException
Does nothing (always ok).
Parameters:
ownerKey - public key of the owner used for verification of the signature
Overrides:
verify in class Certificate

getPublicKey

public final PublicKey getPublicKey()
Returns the public key
Returns:
the public key
Overrides:
getPublicKey in class Certificate

getName

public final String getName()
Returns the name of the public key
Returns:
the name of the public key

toString

public String toString()
Returns a String representation of this public key. Prints just the name.
Returns:
the name of this public key
Overrides:
toString in class Certificate

hashCode

public int hashCode()
Returns a hashcode value for this certificate.
Returns:
a hashcode of the certificate
Overrides:
hashCode in class Certificate
See Also:
Object.hashCode()

equals

public boolean equals(Object other)
Indicates whether some other object is "equal to" this one.
Parameters:
other - the object to compare with
Returns:
true if the objects are equal
Overrides:
equals in class Certificate
See Also:
Object.equals(Object)

Agent System POND 1.0 (1.7.2000)

Submit a bug

Copyright 2000 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.