KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ext > security > crypto > CertificateReader


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive.ext.security.crypto;
32
33 /*
34 * ################################################################
35 *
36 * ProActive: The Java(TM) library for Parallel, Distributed,
37 * Concurrent computing with Security and Mobility
38 *
39 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
40 * Contact: proactive-support@inria.fr
41 *
42 * This library is free software; you can redistribute it and/or
43 * modify it under the terms of the GNU Lesser General Public
44 * License as published by the Free Software Foundation; either
45 * version 2.1 of the License, or any later version.
46 *
47 * This library is distributed in the hope that it will be useful,
48 * but WITHOUT ANY WARRANTY; without even the implied warranty of
49 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
50 * Lesser General Public License for more details.
51 *
52 * You should have received a copy of the GNU Lesser General Public
53 * License along with this library; if not, write to the Free Software
54 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
55 * USA
56 *
57 * Initial developer(s): The ProActive Team
58 * http://www.inria.fr/oasis/ProActive/contacts.html
59 * Contributor(s):
60 *
61 * ################################################################
62 */

63 import java.io.FileInputStream JavaDoc;
64 import java.io.ObjectInputStream JavaDoc;
65
66
67 /**
68  * This class provides a command-line tool to display the properties of a public or private certificate.
69  *
70  * @author Vincent RIBAILLIER
71  * <br>created July 19, 2001
72  */

73 public class CertificateReader {
74
75     /**
76      * Constructor for the CertificateReader object
77      *
78      * @since
79      */

80     public CertificateReader() {
81     }
82
83     /**
84      * The main program for the CertificateReader class
85      *
86      * @param args
87      * @since
88      */

89     public static void main(String JavaDoc[] args) {
90         // Provider myProvider = new org.bouncycastle.jce.provider.BouncyCastleProvider();
91
// Security.addProvider(myProvider);
92
String JavaDoc file_name = "";
93         try {
94             file_name = args[0];
95         } catch (Exception JavaDoc e) {
96             System.out.println("Usage : java CertificateReader mycertificate");
97         }
98         try {
99             FileInputStream JavaDoc fin = new FileInputStream JavaDoc(file_name);
100             ObjectInputStream JavaDoc in = new ObjectInputStream JavaDoc(fin);
101             Object JavaDoc object = in.readObject();
102             in.close();
103             System.out.println(object.toString());
104         } catch (Exception JavaDoc e) {
105             System.out.println("Exception : " + e);
106         }
107     }
108 }
109
Popular Tags