source: branches/libc-0.6/src/gcc/libjava/java/security/Identity.java@ 3103

Last change on this file since 3103 was 1392, checked in by bird, 22 years ago

This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.

  • Property cvs2svn:cvs-rev set to 1.1.1.2
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 10.3 KB
Line 
1/* Identity.java --- Identity Class
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4 This 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.Serializable;
40import java.util.Vector;
41
42/**
43 The Identity class is used to repsent people and companies that
44 can be authenticated using public key encryption. The identities
45 can also be abstract objects such as smart cards.
46
47 Identity object store a name and public key for each identity.
48 The names cannot be changed and the identities can be scoped.
49 Each identity (name and public key) within a scope is unique
50 to that scope.
51
52 Each identity has a set of ceritificates which all specify the
53 same public key but not necessarily the same name.
54
55 The Identity class can be subclassed to allow additional
56 information to be attached to it.
57
58 @since JDK 1.1
59
60 @deprecated Use java.security.KeyStore, the java.security.cert
61 package, and java.security.Principal.
62
63 @author Mark Benvenuto
64 */
65public abstract class Identity implements Principal, Serializable
66{
67 static final long serialVersionUID = 3609922007826600659L;
68
69 private String name;
70 private IdentityScope scope;
71 private PublicKey publicKey;
72 private String info;
73 private Vector certificates;
74
75 /**
76 Creates a new instance of Identity from Serialized Data
77 */
78 protected Identity()
79 {
80 }
81
82 /**
83 Creates a new instance of Identity with the specified name
84 and IdentityScope.
85
86 @param name the name to use
87 @param scope the scope to use
88
89 @throws KeyManagementException if the identity is already
90 present
91 */
92 public Identity(String name, IdentityScope scope)
93 throws KeyManagementException
94 {
95 this.name = name;
96 this.scope = scope;
97 }
98
99 /**
100 Creates a new instance of Identity with the specified name
101 and no scope.
102
103 @param name the name to use
104 */
105 public Identity(String name)
106 {
107 this.name = name;
108 this.scope = null;
109 }
110
111 /**
112 Gets the name for this Identity.
113
114 @return the name
115 */
116 public final String getName()
117 {
118 return name;
119 }
120
121 /**
122 Gets the scope for this Identity.
123
124 @return the scope
125 */
126 public final IdentityScope getScope()
127 {
128 return scope;
129 }
130
131 /**
132 Gets the public key for this identity.
133
134 @return the public key
135 */
136 public PublicKey getPublicKey()
137 {
138 return publicKey;
139 }
140
141 /**
142 Sets the public key for this identity.
143 The old key and all certificates are removed.
144
145 This class checks the security manager with the call
146 checkSecurityAccess with "setIdentityPublicKey".
147
148 @param key the public key to use
149
150 @throws KeyManagementException if this public key is used by
151 another identity in the current scope.