home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / KeyPair.java < prev    next >
Text File  |  1998-01-23  |  2KB  |  73 lines

  1. /*
  2.  * @(#)KeyPair.java    1.3 96/11/23
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. package java.security;
  24.  
  25. import java.util.*;
  26. import java.io.*;
  27. /**
  28.  * <p>This class is a simple holder for a key pair (a public key and a
  29.  * private key). It does not enforce any security, and, when initialized, 
  30.  * should be treated like a PrivateKey.
  31.  *
  32.  * @see PublicKey
  33.  * @see PrivateKey
  34.  *
  35.  * @version 1.3 97/11/25
  36.  * @author Benjamin Renaud
  37.  */
  38. public final class KeyPair { 
  39.  
  40.     private PrivateKey privateKey;
  41.     private PublicKey publicKey;
  42.  
  43.     /**
  44.      * Constructs a key with the specified public key and private key.
  45.      * 
  46.      * @param publicKey the public key.
  47.      * 
  48.      * @param privateKey the private key.
  49.      */
  50.     public KeyPair(PublicKey publicKey, PrivateKey privateKey) {
  51.     this.publicKey = publicKey;
  52.     this.privateKey = privateKey;
  53.     }
  54.  
  55.     /**
  56.      * Returns the public key from this key pair.
  57.      * 
  58.      * @return the public key.
  59.      */
  60.     public PublicKey getPublic() {
  61.     return publicKey;
  62.     }
  63.  
  64.      /**
  65.      * Returns the private key from this key pair.
  66.      * 
  67.      * @return the private key.
  68.      */
  69.    public PrivateKey getPrivate() {
  70.     return privateKey;
  71.     }    
  72. }
  73.