Source Code Cross Referenced for X509IssuerSerial.java in  » 6.0-JDK-Modules-com.sun » xws-security » com » sun » xml » wss » core » reference » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » xws security » com.sun.xml.wss.core.reference 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: X509IssuerSerial.java,v 1.4 2007/01/08 09:28:57 ashutoshshahi Exp $
003:         */
004:
005:        /*
006:         * The contents of this file are subject to the terms
007:         * of the Common Development and Distribution License
008:         * (the License).  You may not use this file except in
009:         * compliance with the License.
010:         * 
011:         * You can obtain a copy of the license at
012:         * https://glassfish.dev.java.net/public/CDDLv1.0.html.
013:         * See the License for the specific language governing
014:         * permissions and limitations under the License.
015:         * 
016:         * When distributing Covered Code, include this CDDL
017:         * Header Notice in each file and include the License file
018:         * at https://glassfish.dev.java.net/public/CDDLv1.0.html.
019:         * If applicable, add the following below the CDDL Header,
020:         * with the fields enclosed by brackets [] replaced by
021:         * you own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         * 
024:         * Copyright 2006 Sun Microsystems Inc. All Rights Reserved
025:         */
026:
027:        package com.sun.xml.wss.core.reference;
028:
029:        import java.math.BigInteger;
030:        import java.security.cert.X509Certificate;
031:        import java.util.Iterator;
032:        import java.util.logging.Level;
033:        import java.util.logging.Logger;
034:
035:        import javax.xml.soap.SOAPElement;
036:        import javax.xml.soap.SOAPException;
037:
038:        import org.w3c.dom.Document;
039:
040:        import com.sun.org.apache.xml.internal.security.keys.content.x509.XMLX509IssuerSerial;
041:        import com.sun.xml.wss.logging.LogDomainConstants;
042:        import com.sun.xml.wss.impl.MessageConstants;
043:        import com.sun.xml.wss.core.ReferenceElement;
044:        import com.sun.xml.wss.impl.XMLUtil;
045:        import com.sun.xml.wss.XWSSecurityException;
046:
047:        /**
048:         * @author Vishal Mahajan
049:         */
050:        public class X509IssuerSerial extends ReferenceElement {
051:
052:            private static Logger log = Logger.getLogger(
053:                    LogDomainConstants.WSS_API_DOMAIN,
054:                    LogDomainConstants.WSS_API_DOMAIN_BUNDLE);
055:
056:            private XMLX509IssuerSerial delegate;
057:            private X509Certificate cert = null;
058:
059:            private Document ownerDoc;
060:
061:            /**
062:             * Constructor X509IssuerSerial
063:             *
064:             * @param element
065:             */
066:            public X509IssuerSerial(SOAPElement element)
067:                    throws XWSSecurityException {
068:
069:                boolean throwAnException = false;
070:                if (!(element.getLocalName().equals("X509Data") && XMLUtil
071:                        .inSignatureNS(element))) {
072:                    throwAnException = true;
073:                }
074:
075:                SOAPElement issuerSerialElement;
076:                try {
077:                    issuerSerialElement = (SOAPElement) element
078:                            .getChildElements(
079:                                    soapFactory.createName("X509IssuerSerial",
080:                                            MessageConstants.DSIG_PREFIX,
081:                                            MessageConstants.DSIG_NS)).next();
082:                } catch (Exception e) {
083:                    log.log(Level.SEVERE, "WSS0750.soap.exception",
084:                            new Object[] { "ds:X509IssuerSerial",
085:                                    e.getMessage() });
086:                    throw new XWSSecurityException(e);
087:                }
088:
089:                Iterator issuerNames;
090:                try {
091:                    issuerNames = issuerSerialElement
092:                            .getChildElements(soapFactory.createName(
093:                                    "X509IssuerName",
094:                                    MessageConstants.DSIG_PREFIX,
095:                                    MessageConstants.DSIG_NS));
096:                } catch (SOAPException e) {
097:                    log
098:                            .log(Level.SEVERE, "WSS0758.soap.exception",
099:                                    new Object[] { "ds:X509IssuerName",
100:                                            e.getMessage() });
101:                    throw new XWSSecurityException(e);
102:                }
103:                if (!issuerNames.hasNext())
104:                    throwAnException = true;
105:                SOAPElement issuerNameElement = (SOAPElement) issuerNames
106:                        .next();
107:                String issuerName = XMLUtil
108:                        .getFullTextFromChildren(issuerNameElement);
109:
110:                Iterator serialNumbers;
111:                try {
112:                    serialNumbers = issuerSerialElement
113:                            .getChildElements(soapFactory.createName(
114:                                    "X509SerialNumber",
115:                                    MessageConstants.DSIG_PREFIX,
116:                                    MessageConstants.DSIG_NS));
117:                } catch (SOAPException e) {
118:                    log.log(Level.SEVERE, "WSS0758.soap.exception",
119:                            new Object[] { "ds:X509SerialNumber",
120:                                    e.getMessage() });
121:                    throw new XWSSecurityException(e);
122:                }
123:                if (!serialNumbers.hasNext())
124:                    throwAnException = true;
125:                SOAPElement serialNumberElement = (SOAPElement) serialNumbers
126:                        .next();
127:                String serialNumberString = XMLUtil
128:                        .getFullTextFromChildren(serialNumberElement);
129:                BigInteger serialNumber = new BigInteger(serialNumberString);
130:
131:                if (throwAnException) {
132:                    log
133:                            .log(Level.SEVERE,
134:                                    "WSS0759.error.creating.issuerserial");
135:                    throw new XWSSecurityException(
136:                            "Cannot create X509IssuerSerial object out of given element");
137:                }
138:                ownerDoc = element.getOwnerDocument();
139:                delegate = new XMLX509IssuerSerial(ownerDoc, issuerName,
140:                        serialNumber);
141:            }
142:
143:            /**
144:             * Constructor X509IssuerSerial
145:             *
146:             * @param doc
147:             * @param X509IssuerName
148:             * @param X509SerialNumber
149:             */
150:            public X509IssuerSerial(Document doc, String X509IssuerName,
151:                    BigInteger X509SerialNumber) {
152:                delegate = new XMLX509IssuerSerial(doc, X509IssuerName,
153:                        X509SerialNumber);
154:                ownerDoc = doc;
155:            }
156:
157:            /**
158:             * Constructor X509IssuerSerial
159:             *
160:             * @param doc
161:             * @param X509IssuerName
162:             * @param X509SerialNumber
163:             */
164:            public X509IssuerSerial(Document doc, String X509IssuerName,
165:                    String X509SerialNumber) {
166:                delegate = new XMLX509IssuerSerial(doc, X509IssuerName,
167:                        X509SerialNumber);
168:                ownerDoc = doc;
169:            }
170:
171:            /**
172:             * Constructor X509IssuerSerial
173:             *
174:             * @param doc
175:             * @param X509IssuerName
176:             * @param X509SerialNumber
177:             */
178:            public X509IssuerSerial(Document doc, String X509IssuerName,
179:                    int X509SerialNumber) {
180:                delegate = new XMLX509IssuerSerial(doc, X509IssuerName,
181:                        X509SerialNumber);
182:                ownerDoc = doc;
183:            }
184:
185:            /**
186:             * Constructor X509IssuerSerial
187:             *
188:             * @param doc
189:             * @param x509certificate
190:             */
191:            public X509IssuerSerial(Document doc,
192:                    X509Certificate x509certificate) {
193:                delegate = new XMLX509IssuerSerial(doc, x509certificate);
194:                ownerDoc = doc;
195:            }
196:
197:            /**
198:             * Method getSerialNumber
199:             *
200:             * @throws XWSSecurityException
201:             */
202:            public BigInteger getSerialNumber() throws XWSSecurityException {
203:                try {
204:                    return delegate.getSerialNumber();
205:                } catch (Exception e) {
206:                    throw new XWSSecurityException(e);
207:                }
208:            }
209:
210:            /**
211:             * Method getSerialNumberInteger
212:             *
213:             * @throws XWSSecurityException
214:             */
215:            public int getSerialNumberInteger() throws XWSSecurityException {
216:                try {
217:                    return delegate.getSerialNumberInteger();
218:                } catch (Exception e) {
219:                    throw new XWSSecurityException(e);
220:                }
221:            }
222:
223:            /**
224:             * Method getIssuerName
225:             *
226:             * @throws XWSSecurityException
227:             */
228:            public String getIssuerName() throws XWSSecurityException {
229:                try {
230:                    return delegate.getIssuerName();
231:                } catch (Exception e) {
232:                    log.log(Level.SEVERE, "WSS0763.exception.issuername",
233:                            new Object[] { e.getMessage() });
234:                    throw new XWSSecurityException(e);
235:                }
236:            }
237:
238:            public SOAPElement getAsSoapElement() throws XWSSecurityException {
239:                try {
240:                    SOAPElement issuerSerialElement = (SOAPElement) delegate
241:                            .getElement();
242:                    SOAPElement x509DataElement = (SOAPElement) ownerDoc
243:                            .createElementNS(MessageConstants.DSIG_NS,
244:                                    MessageConstants.DSIG_PREFIX + ":X509Data");
245:                    x509DataElement.addNamespaceDeclaration(
246:                            MessageConstants.DSIG_PREFIX,
247:                            MessageConstants.DSIG_NS);
248:                    x509DataElement.addChildElement(issuerSerialElement);
249:                    setSOAPElement(x509DataElement);
250:                    return x509DataElement;
251:                } catch (Exception e) {
252:                    log.log(Level.SEVERE, "WSS0750.soap.exception",
253:                            new Object[] { "ds:X509IssuerSerial",
254:                                    e.getMessage() });
255:                    throw new XWSSecurityException(e);
256:                }
257:            }
258:
259:            public void setCertificate(X509Certificate cert) {
260:                this .cert = cert;
261:            }
262:
263:            public X509Certificate getCertificate() {
264:                return cert;
265:            }
266:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.