[Webfunds-commits] java/webfunds/sox ServerKeyReply.java ServerKeyRequest.java

Jeroen C. van Gelderen gelderen@cypherpunks.ai
Sat, 19 Aug 2000 22:25:18 -0400 (AST)


gelderen    00/08/19 22:25:18

  Added:       webfunds/sox ServerKeyReply.java ServerKeyRequest.java
  Log:
  Initial version.

Revision  Changes    Path
1.1                  java/webfunds/sox/ServerKeyReply.java

Index: ServerKeyReply.java
===================================================================
/*
 * $Id: ServerKeyReply.java,v 1.1 2000/08/20 02:25:17 gelderen Exp $
 *
 * Copyright (c) Systemics Ltd 1995-1999 on behalf of
 * the WebFunds Development Team.  All Rights Reserved.
 */
package webfunds.sox;

import java.io.*;
import java.security.PublicKey;
import java.security.cert.Certificate;


public class ServerKeyReply extends BasicReply
{
    /**
     * The certificate contained in the reply
     */
    protected Certificate cert;
  
    /**
     * Get the certificate.
     */
    public Certificate getCertificate() { return cert; }
    public PublicKey getKey() { return Crypto.getPublicKeyFromCert(cert); }
  
  
    /**
      * Create a reply containing a comms key
      * @param cert The comms key reply
      */
    public ServerKeyReply(Certificate cert)
    {
        this.cert = cert;
    }
   
    public ServerKeyReply(byte[] data)
        throws SOXPacketException
    {
        super(data);
    }
  
    public ServerKeyReply(InputStream is)
        throws IOException, SOXPacketException
    {
        super(is);
    }
  
    public void encode(OutputStream os)
        throws IOException
    {
        DataOutputStream dos = new DataOutputStream(os);
        writeCertificate(dos, cert);
    }
        
    public void decode(InputStream is)
        throws IOException, SOXPacketException
    {
        DataInputStream dis = new DataInputStream(is);
        cert = readCertificate(dis);
    }
  
    public String toString()
    {
        String s = "ServerKeyReply [";
        s += "Cert: "+cert + "]\n";
        return s;
    }
}



1.1                  java/webfunds/sox/ServerKeyRequest.java

Index: ServerKeyRequest.java
===================================================================
/*
 * $Id: ServerKeyRequest.java,v 1.1 2000/08/20 02:25:17 gelderen Exp $
 *
 * Copyright (c) Systemics Ltd 1995-1999 on behalf of
 * the WebFunds Development Team.  All Rights Reserved.
 */
package webfunds.sox;

import java.io.*;


public class ServerKeyRequest extends BasicRequest {

    public ServerKeyRequest() {}

    public ServerKeyRequest(byte[] data)
        throws IOException, SOXPacketException
    {
        super(data);
    }

    public ServerKeyRequest(InputStream is)
        throws IOException, SOXPacketException
    {
        super(is);
    }

    public void encode(OutputStream os) throws IOException {
        // no payload
    }
      

    public void decode(InputStream is) throws IOException {
        // no payload
    }

    public String toString() {
        return "ServerKeyRequest";
    }
}