Source Code Cross Referenced for KeyValue.java in  » 6.0-JDK-Core » xml » javax » xml » crypto » dsig » keyinfo » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » xml » javax.xml.crypto.dsig.keyinfo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025        /*
026         * $Id: KeyValue.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
027         */
028        package javax.xml.crypto.dsig.keyinfo;
029
030        import java.security.KeyException;
031        import java.security.KeyStore;
032        import java.security.PublicKey;
033        import java.security.interfaces.DSAPublicKey;
034        import java.security.interfaces.RSAPublicKey;
035        import javax.xml.crypto.XMLStructure;
036
037        /**
038         * A representation of the XML <code>KeyValue</code> element as defined
039         * in the <a href="http://www.w3.org/TR/xmldsig-core/">
040         * W3C Recommendation for XML-Signature Syntax and Processing</a>. A 
041         * <code>KeyValue</code> object contains a single public key that may be
042         * useful in validating the signature. The XML schema definition is defined as:
043         *
044         * <pre>
045         *    &lt;element name="KeyValue" type="ds:KeyValueType"/&gt;
046         *    &lt;complexType name="KeyValueType" mixed="true"&gt;
047         *      &lt;choice&gt;
048         *        &lt;element ref="ds:DSAKeyValue"/&gt;
049         *        &lt;element ref="ds:RSAKeyValue"/&gt;
050         *        &lt;any namespace="##other" processContents="lax"/&gt;
051         *      &lt;/choice&gt;
052         *    &lt;/complexType&gt;
053         *
054         *    &lt;element name="DSAKeyValue" type="ds:DSAKeyValueType"/&gt;
055         *    &lt;complexType name="DSAKeyValueType"&gt;
056         *      &lt;sequence&gt;
057         *        &lt;sequence minOccurs="0"&gt;
058         *          &lt;element name="P" type="ds:CryptoBinary"/&gt;
059         *          &lt;element name="Q" type="ds:CryptoBinary"/&gt;
060         *        &lt;/sequence&gt;
061         *        &lt;element name="G" type="ds:CryptoBinary" minOccurs="0"/&gt; 
062         *        &lt;element name="Y" type="ds:CryptoBinary"/&gt; 
063         *        &lt;element name="J" type="ds:CryptoBinary" minOccurs="0"/&gt;
064         *        &lt;sequence minOccurs="0"&gt;
065         *          &lt;element name="Seed" type="ds:CryptoBinary"/&gt; 
066         *          &lt;element name="PgenCounter" type="ds:CryptoBinary"/&gt; 
067         *        &lt;/sequence&gt;
068         *      &lt;/sequence&gt;
069         *    &lt;/complexType&gt;
070         *
071         *    &lt;element name="RSAKeyValue" type="ds:RSAKeyValueType"/&gt;
072         *    &lt;complexType name="RSAKeyValueType"&gt;
073         *      &lt;sequence&gt;
074         *        &lt;element name="Modulus" type="ds:CryptoBinary"/&gt; 
075         *        &lt;element name="Exponent" type="ds:CryptoBinary"/&gt;
076         *      &lt;/sequence&gt;
077         *    &lt;/complexType&gt;
078         * </pre>
079         * A <code>KeyValue</code> instance may be created by invoking the
080         * {@link KeyInfoFactory#newKeyValue newKeyValue} method of the
081         * {@link KeyInfoFactory} class, and passing it a {@link 
082         * java.security.PublicKey} representing the value of the public key. Here is 
083         * an example of creating a <code>KeyValue</code> from a {@link DSAPublicKey} 
084         * of a {@link java.security.cert.Certificate} stored in a 
085         * {@link java.security.KeyStore}:
086         * <pre>
087         * KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
088         * PublicKey dsaPublicKey = keyStore.getCertificate("myDSASigningCert").getPublicKey();
089         * KeyInfoFactory factory = KeyInfoFactory.getInstance("DOM");
090         * KeyValue keyValue = factory.newKeyValue(dsaPublicKey);
091         * </pre>
092         *
093         * This class returns the <code>DSAKeyValue</code> and 
094         * <code>RSAKeyValue</code> elements as objects of type 
095         * {@link DSAPublicKey} and {@link RSAPublicKey}, respectively. Note that not 
096         * all of the fields in the schema are accessible as parameters of these 
097         * types. 
098         * 
099         * @author Sean Mullan
100         * @author JSR 105 Expert Group
101         * @since 1.6
102         * @see KeyInfoFactory#newKeyValue(PublicKey)
103         */
104        public interface KeyValue extends XMLStructure {
105
106            /**
107             * URI identifying the DSA KeyValue KeyInfo type:
108             * http://www.w3.org/2000/09/xmldsig#DSAKeyValue. This can be specified as 
109             * the value of the <code>type</code> parameter of the 
110             * {@link RetrievalMethod} class to describe a remote 
111             * <code>DSAKeyValue</code> structure.
112             */
113            final static String DSA_TYPE = "http://www.w3.org/2000/09/xmldsig#DSAKeyValue";
114
115            /**
116             * URI identifying the RSA KeyValue KeyInfo type:
117             * http://www.w3.org/2000/09/xmldsig#RSAKeyValue. This can be specified as
118             * the value of the <code>type</code> parameter of the 
119             * {@link RetrievalMethod} class to describe a remote 
120             * <code>RSAKeyValue</code> structure.
121             */
122            final static String RSA_TYPE = "http://www.w3.org/2000/09/xmldsig#RSAKeyValue";
123
124            /**
125             * Returns the public key of this <code>KeyValue</code>. 
126             *
127             * @return the public key of this <code>KeyValue</code>
128             * @throws KeyException if this <code>KeyValue</code> cannot be converted
129             *    to a <code>PublicKey</code>
130             */
131            PublicKey getPublicKey() throws KeyException;
132        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.