KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > security > util > CertNode


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1997-2004 Gerald Brose.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  */

20
21 package org.jacorb.security.util;
22
23 /**
24  * This class represents key store entries
25  *
26  * @author Gerald Brose, FU Berlin
27  * @version $Id: CertNode.java,v 1.7 2004/05/06 12:40:01 nicolas Exp $
28  */

29
30 import java.security.*;
31 import java.security.cert.*;
32 import java.util.*;
33 import javax.swing.tree.*;
34 import iaik.asn1.*;
35 import iaik.asn1.structures.*;
36 import iaik.x509.*;
37 import iaik.x509.extensions.*;
38
39 public class CertNode
40     implements KSNode
41 {
42     /** if this entry represents a key entry or a trusted cert entry,
43     this is its alias */

44
45     private String JavaDoc label;
46     private KeyNode parent;
47     private int chainIndex;
48     private iaik.x509.X509Certificate cert;
49
50     /**
51      * constructor for cert entries
52      */

53
54     public CertNode(iaik.x509.X509Certificate cert, int index)
55     {
56     this.cert = cert;
57     chainIndex = index;
58     }
59
60     public iaik.x509.X509Certificate getCert()
61     {
62     return cert;
63     }
64
65     /* TreeNode interface: */
66
67     public Enumeration children()
68     {
69     return null;
70     }
71
72     public boolean getAllowsChildren()
73     {
74     return false;
75     }
76
77     public TreeNode getChildAt(int index)
78     {
79     return null;
80     }
81
82     public int getChildCount()
83     {
84     return 0;
85     }
86
87     public int getIndex(TreeNode node)
88     {
89     return -1;
90     }
91
92     public TreeNode getParent()
93     {
94     return parent;
95     }
96
97     public boolean isLeaf()
98     {
99     return true;
100     }
101
102      /* MutableTreeNode interface: */
103
104     public void insert(MutableTreeNode child, int index)
105     {
106     }
107
108     public void remove(int index)
109     {
110     }
111
112     public void remove(MutableTreeNode child)
113     {
114     }
115
116     public void setParent(MutableTreeNode parent)
117     {
118     this.parent = (KeyNode)parent;
119     }
120
121     public void setUserObject(Object JavaDoc o)
122     {}
123
124
125     public void removeFromParent()
126     {
127     parent.remove(this);
128     parent = null;
129     }
130
131     public String JavaDoc toString()
132     {
133     return "subject: " + cert.getSubjectDN().getName() + " issuer: " + cert.getIssuerDN().getName();
134     }
135
136     public TreeNode[] getPath()
137     {
138     if( parent == null )
139         return null;
140     else
141         return new TreeNode[] { getParent().getParent(), getParent() };
142     }
143
144 }
145
146
147
148
149
150
151
152
153
154
155
156
157
158
Popular Tags