View Javadoc

1   /*
2    *  MicroEmulator
3    *  Copyright (C) 2006 Bartek Teodorczyk <barteo@barteo.net>
4    *
5    *  It is licensed under the following two licenses as alternatives:
6    *    1. GNU Lesser General Public License (the "LGPL") version 2.1 or any newer version
7    *    2. Apache License (the "AL") Version 2.0
8    *
9    *  You may not use this file except in compliance with at least one of
10   *  the above two licenses.
11   *
12   *  You may obtain a copy of the LGPL at
13   *      http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
14   *
15   *  You may obtain a copy of the AL at
16   *      http://www.apache.org/licenses/LICENSE-2.0
17   *
18   *  Unless required by applicable law or agreed to in writing, software
19   *  distributed under the License is distributed on an "AS IS" BASIS,
20   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21   *  See the LGPL or the AL for the specific language governing permissions and
22   *  limitations.
23   */
24  
25  package org.microemu.cldc;
26  
27  import java.security.cert.X509Certificate;
28  
29  import javax.microedition.pki.Certificate;
30  
31  public class CertificateImpl implements Certificate {
32  	
33  	private X509Certificate cert;
34  
35  	public CertificateImpl(X509Certificate cert) {
36  		this.cert = cert;
37  	}
38  
39  	public String getIssuer() {
40  		return cert.getIssuerDN().getName();
41  	}
42  
43  	public long getNotAfter() {
44  		return cert.getNotAfter().getTime();
45  	}
46  
47  	public long getNotBefore() {
48  		return cert.getNotBefore().getTime();
49  	}
50  
51  	public String getSerialNumber() {
52  		return cert.getSerialNumber().toString();
53  	}
54  
55  	public String getSigAlgName() {
56  		return cert.getSigAlgName();
57  	}
58  
59  	public String getSubject() {
60  		return cert.getSubjectDN().getName();
61  	}
62  
63  	public String getType() {
64  		return cert.getType();
65  	}
66  
67  	public String getVersion() {
68  		return Integer.toString(cert.getVersion());
69  	}
70  
71  }