OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [javax/] [security/] [cert/] [X509Certificate.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* X509Certificate.java -- base class of X.509 certificates.
2
   Copyright (C) 2004 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
package javax.security.cert;
40
 
41
import java.io.ByteArrayInputStream;
42
import java.io.InputStream;
43
 
44
import java.math.BigInteger;
45
 
46
import java.security.Principal;
47
import java.security.cert.CertificateFactory;
48
 
49
import java.util.Date;
50
 
51
/**
52
 * <p>The base class of all X.509 certificates.</p>
53
 *
54
 * <p><b>This class is deprecated in favor of the {@link
55
 * java.security.cert.X509Certificate} class. It should not be used in new
56
 * applications.</b></p>
57
 */
58
public abstract class X509Certificate extends Certificate
59
{
60
 
61
  // Class methods.
62
  // -------------------------------------------------------------------------
63
 
64
  /**
65
   * <p>Get an instance of X509Certificate for the given encoded bytes.</p>
66
   *
67
   * @param encoded The encoded certificate.
68
   * @return An instance of X509Certificate.
69
   * @throws CertificateException If the encoded certificate cannot be parsed.
70
   */
71
  public static X509Certificate getInstance(byte[] encoded)
72
    throws CertificateException
73
  {
74
    return getInstance(new ByteArrayInputStream(encoded));
75
  }
76
 
77
  /**
78
   * <p>Get an instance of X509Certificate for the given encoded stream.</p>
79
   *
80
   * @param encoded The encoded certificate stream..
81
   * @return An instance of X509Certificate.
82
   * @throws CertificateException If the encoded certificate cannot be parsed.
83
   */
84
  public static X509Certificate getInstance(InputStream encoded)
85
    throws CertificateException
86
  {
87
    try
88
      {
89
        CertificateFactory cf = CertificateFactory.getInstance("X.509");
90
        return new X509CertBridge((java.security.cert.X509Certificate)
91
                                  cf.generateCertificate(encoded));
92
      }
93
    catch (java.security.cert.CertificateException ce)
94
      {
95
        throw new CertificateException(ce.getMessage());
96
      }
97
  }
98
 
99
  // Abstract methods.
100
  // -------------------------------------------------------------------------
101
 
102
  /**
103
   * <p>Check if this certificate is valid now.</p>
104
   *
105
   * @throws CertificateExpiredException If the certificate has expired.
106
   * @throws CertificateNotYetValidException If the certificate is not yet valid.
107
   * @see #checkValidity(java.util.Date)
108
   */
109
  public abstract void checkValidity()
110
    throws CertificateExpiredException, CertificateNotYetValidException;
111
 
112
  /**
113
   * <p>Check if this certificate is valid for the given date.</p>
114
   *
115
   * @param date The date to check.
116
   * @throws CertificateExpiredException If the certificate has expired.
117
   * @throws CertificateNotYetValidException If the certificate is not yet valid.
118
   */
119
  public abstract void checkValidity(Date date)
120
    throws CertificateExpiredException, CertificateNotYetValidException;
121
 
122
  /**
123
   * <p>Returns the X.509 version number.</p>
124
   *
125
   * @return The version number.
126
   */
127
  public abstract int getVersion();
128
 
129
  /**
130
   * <p>Returns this certificate's serial number.</p>
131
   *
132
   * @return The serial number.
133
   */
134
  public abstract BigInteger getSerialNumber();
135
 
136
  /**
137
   * <p>Returns the distinguished name of this certificate's issuer.</p>
138
   *
139
   * @return The issuer's distinguished name.
140
   */
141
  public abstract Principal getIssuerDN();
142
 
143
  /**
144
   * <p>Returns the distinguished name of this certificate's subject.</p>
145
   *
146
   * @return The subject's distinguished name.
147
   */
148
  public abstract Principal getSubjectDN();
149
 
150
  /**
151
   * <p>Returns the <i>not before</i> portion of this certificate's validity
152
   * period.</p>
153
   *
154
   * @return The not before date.
155
   */
156
  public abstract Date getNotBefore();
157
 
158
  /**
159
   * <p>Returns the <i>not after</i> portion of this certificate's validity
160
   * period.</p>
161
   *
162
   * @return The not after date.
163
   */
164
  public abstract Date getNotAfter();
165
 
166
  /**
167
   * <p>Returns the name of this certificate's signature algorithm.</p>
168
   *
169
   * @return The name of the signature algorithm.
170
   */
171
  public abstract String getSigAlgName();
172
 
173
  /**
174
   * <p>Returns the object identifier (OID) of this certificate's signature
175
   * algorithm. The returned string is a sequence of integers separated by
176
   * periods.</p>
177
   *
178
   * @return The signature OID.
179
   */
180
  public abstract String getSigAlgOID();
181
 
182
  /**
183
   * <p>Returns the signature parameters. The returned byte array contains the
184
   * raw DER-encoded parameters.</p>
185
   *
186
   * @return The signature parameters.
187
   */
188
  public abstract byte[] getSigAlgParams();
189
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.