home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / Key.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  109 lines

  1. /*
  2.  * @(#)Key.java    1.28 97/01/16
  3.  * 
  4.  * Copyright (c) 1995, 1996, 1997 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. /**
  26.  * The Key interface is the top-level interface for all keys. It
  27.  * defines the functionality shared by all key objects. All keys
  28.  * have three characteristics:
  29.  * 
  30.  * <UL>
  31.  * 
  32.  * <LI>An Algorithm
  33.  * 
  34.  * <P>This is the key algorithm for that key. The key algorithm is usually
  35.  * an encryption or asymmetric operation algorithm (such as DSA or
  36.  * RSA), which will work with those algorithms and with related
  37.  * algorithms (such as MD5 with RSA, SHA-1 with RSA, Raw DSA, etc.)
  38.  * The name of the algorithm of a key is obtained using the 
  39.  * <a href = "#getAlgorithm">getAlgorithm</a> method.<P>
  40.  * 
  41.  * <LI>An Encoded Form
  42.  * 
  43.  * <P>This is an external encoded form for the key used when a standard
  44.  * representation of the key is needed outside the Java Virtual Machine,
  45.  * as when transmitting the key to some other party. The key
  46.  * is encoded according to a standard format (such as X.509
  47.  * or PKCS#8), and is returned using the 
  48.  * <a href = "#getEncoded">getEncoded</a> method.<P>
  49.  * 
  50.  * <LI>A Format
  51.  * 
  52.  * <P>This is the name of the format of the encoded key. It is returned 
  53.  * by the <a href = "#getFormat">getFormat</a> method.<P>
  54.  * 
  55.  * </UL>
  56.  * 
  57.  * Keys are generally obtained through key generators, certificates,
  58.  * or various Identity classes used to manage keys. There are no
  59.  * provisions in this release for the parsing of encoded keys and
  60.  * certificates.
  61.  *
  62.  * @see PublicKey
  63.  * @see PrivateKey
  64.  * @see KeyPair
  65.  * @see KeyPairGenerator
  66.  * @see Identity
  67.  * @see IdentityScope
  68.  * @see Signer
  69.  *
  70.  * @version 1.28, 97/01/29
  71.  * @author Benjamin Renaud 
  72.  */
  73.  
  74. public interface Key  extends java.io.Serializable {
  75.  
  76.     /**
  77.      * Returns the standard algorithm name this key is for. For
  78.      * example, "DSA" would indicate that this key is a DSA key. 
  79.      * Note that this method may return null, when the
  80.      * algorithm this key is for is unknown.
  81.      * 
  82.      * <p>See Appendix A in the <a href=
  83.      * "../guide/security/CryptoSpec.html#AppA">
  84.      * Java Cryptography Architecture API Specification & Reference </a> 
  85.      * for information about standard algorithm names.
  86.      * 
  87.      * @return the name of the algorithm this key is for, or null
  88.      * if the algorithm this key is for is unknown.  
  89.      */
  90.     public String getAlgorithm();
  91.  
  92.     /**
  93.      * Returns the format used to encode the key or null if the key does not
  94.      * support encoding.
  95.      * 
  96.      * @return the format used to encode the key.
  97.      */
  98.     public String getFormat();
  99.  
  100.     /**
  101.      * Returns the encoded key.
  102.      * 
  103.      * @return the encoded key, or null if the key does not support
  104.      * encoding.
  105.      *
  106.      */
  107.     public byte[] getEncoded();
  108. }
  109.