Agent System POND 1.2 (28.2.2002)

PkgAgentSystem.Crypto
Class PublicKeyCertificate

java.lang.Object
  |
  +--java.security.cert.Certificate
        |
        +--PkgAgentSystem.Crypto.PublicKeyCertificate
All Implemented Interfaces:
Serializable

final class PublicKeyCertificate
extends Certificate

Stores a public key with its name in a certificate.

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
Serialized Form

Inner classes inherited from class java.security.cert.Certificate
Certificate.CertificateRep
 
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, writeReplace
 
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.
Overrides:
getEncoded in class Certificate
Returns:
the array of bytes with the encoded certificate
Throws:
CertificateEncodingException - if an error occured during encoding

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).
Overrides:
verify in class Certificate
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

verify

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

getPublicKey

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

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.
Overrides:
toString in class Certificate
Returns:
the name of this public key

hashCode

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

equals

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

Agent System POND 1.2 (28.2.2002)

Submit a bug

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