source: trunk/src/gcc/libjava/java/security/KeyStoreSpi.java@ 192

Last change on this file since 192 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 8.5 KB
Line 
1/* KeyStoreSpi.java --- Key Store Service Provider Interface
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4This file is part of GNU Classpath.
5
6GNU Classpath is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU Classpath is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Classpath; see the file COPYING. If not, write to the
18Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
1902111-1307 USA.
20
21Linking this library statically or dynamically with other modules is
22making a combined work based on this library. Thus, the terms and
23conditions of the GNU General Public License cover the whole
24combination.
25
26As a special exception, the copyright holders of this library give you
27permission to link this library with independent modules to produce an
28executable, regardless of the license terms of these independent
29modules, and to copy and distribute the resulting executable under
30terms of your choice, provided that you also meet, for each linked
31independent module, the terms and conditions of the license of that
32module. An independent module is a module which is not derived from
33or based on this library. If you modify this library, you may extend
34this exception to your version of the library, but you are not
35obligated to do so. If you do not wish to do so, delete this
36exception statement from your version. */
37
38package java.security;
39import java.io.InputStream;
40import java.io.IOException;
41import java.io.OutputStream;
42import java.security.cert.CertificateException;
43import java.util.Date;
44import java.util.Enumeration;
45
46/**
47 KeyStoreSpi is the Service Provider Interface (SPI) for the
48 KeyStore class. This is the interface for providers to
49 supply to implement a keystore for a particular keystore
50 type.
51
52 @since JDK 1.2
53 @author Mark Benvenuto
54 */
55public abstract class KeyStoreSpi
56{
57 /**
58 Constructs a new KeyStoreSpi
59 */
60 public KeyStoreSpi()
61 {
62 }
63
64 /**
65 Returns the key associated with given alias using the
66 supplied password.
67
68 @param alias an alias for the key to get
69 @param password password to access key with
70
71 @return the requested key, or null otherwise
72
73 @throws NoSuchAlgorithmException if there is no algorithm
74 for recovering the key
75 @throws UnrecoverableKeyException key cannot be reocovered
76 (wrong password).
77 */
78 public abstract Key engineGetKey(String alias, char[]password)
79 throws NoSuchAlgorithmException, UnrecoverableKeyException;
80
81 /**
82 Gets a Certificate chain for the specified alias.
83
84 @param alias the alias name
85
86 @return a chain of Certificates ( ordered from the user's
87 certificate to the Certificate Authority's ) or
88 null if the alias does not exist or there is no
89 certificate chain for the alias ( the alias refers
90 to a trusted certificate entry or there is no entry).
91 */
92 public abstract java.security.cert.
93 Certificate[] engineGetCertificateChain(String alias);
94
95
96 /**
97 Gets a Certificate for the specified alias.
98
99 If there is a trusted certificate entry then that is returned.
100 it there is a key entry with a certificate chain then the
101 first certificate is return or else null.
102
103 @param alias the alias name
104
105 @return a Certificate or null if the alias does not exist
106 or there is no certificate for the alias
107 */
108 public abstract java.security.cert.
109 Certificate engineGetCertificate(String alias);
110
111 /**
112 Gets entry creation date for the specified alias.
113
114 @param alias the alias name
115
116 @returns the entry creation date or null
117 */
118 public abstract Date engineGetCreationDate(String alias);
119
120 /**
121 Assign the key to the alias in the keystore, protecting it
122 with the given password. It will overwrite an existing
123 entry and if the key is a PrivateKey, also add the
124 certificate chain representing the corresponding public key.
125
126 @param alias the alias name
127 @param key the key to add
128 @password the password to protect with
129 @param chain the certificate chain for the corresponding
130 public key
131
132 @throws KeyStoreException if it fails
133 */
134 public abstract void engineSetKeyEntry(String alias, Key key,
135 char[]password,
136 java.security.cert.
137 Certificate[]chain) throws
138 KeyStoreException;