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: PGPData.java,v 1.4 2005/05/10 16:35:35 mullan Exp $
027 */
028 package javax.xml.crypto.dsig.keyinfo;
029
030 import java.util.Collections;
031 import java.util.List;
032 import javax.xml.crypto.XMLStructure;
033
034 /**
035 * A representation of the XML <code>PGPData</code> element as defined in
036 * the <a href="http://www.w3.org/TR/xmldsig-core/">
037 * W3C Recommendation for XML-Signature Syntax and Processing</a>. A
038 * <code>PGPData</code> object is used to convey information related to
039 * PGP public key pairs and signatures on such keys. The XML Schema Definition
040 * is defined as:
041 *
042 * <pre>
043 * <element name="PGPData" type="ds:PGPDataType"/>
044 * <complexType name="PGPDataType">
045 * <choice>
046 * <sequence>
047 * <element name="PGPKeyID" type="base64Binary"/>
048 * <element name="PGPKeyPacket" type="base64Binary" minOccurs="0"/>
049 * <any namespace="##other" processContents="lax" minOccurs="0"
050 * maxOccurs="unbounded"/>
051 * </sequence>
052 * <sequence>
053 * <element name="PGPKeyPacket" type="base64Binary"/>
054 * <any namespace="##other" processContents="lax" minOccurs="0"
055 * maxOccurs="unbounded"/>
056 * </sequence>
057 * </choice>
058 * </complexType>
059 * </pre>
060 *
061 * A <code>PGPData</code> instance may be created by invoking one of the
062 * {@link KeyInfoFactory#newPGPData newPGPData} methods of the {@link
063 * KeyInfoFactory} class, and passing it
064 * <code>byte</code> arrays representing the contents of the PGP public key
065 * identifier and/or PGP key material packet, and an optional list of
066 * elements from an external namespace.
067 *
068 * @author Sean Mullan
069 * @author JSR 105 Expert Group
070 * @since 1.6
071 * @see KeyInfoFactory#newPGPData(byte[])
072 * @see KeyInfoFactory#newPGPData(byte[], byte[], List)
073 * @see KeyInfoFactory#newPGPData(byte[], List)
074 */
075 public interface PGPData extends XMLStructure {
076
077 /**
078 * URI identifying the PGPData KeyInfo type:
079 * http://www.w3.org/2000/09/xmldsig#PGPData. This can be specified as the
080 * value of the <code>type</code> parameter of the {@link RetrievalMethod}
081 * class to describe a remote <code>PGPData</code> structure.
082 */
083 final static String TYPE = "http://www.w3.org/2000/09/xmldsig#PGPData";
084
085 /**
086 * Returns the PGP public key identifier of this <code>PGPData</code> as
087 * defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
088 * section 11.2.
089 *
090 * @return the PGP public key identifier (may be <code>null</code> if
091 * not specified). Each invocation of this method returns a new clone
092 * to protect against subsequent modification.
093 */
094 byte[] getKeyId();
095
096 /**
097 * Returns the PGP key material packet of this <code>PGPData</code> as
098 * defined in <a href="http://www.ietf.org/rfc/rfc2440.txt">RFC 2440</a>,
099 * section 5.5.
100 *
101 * @return the PGP key material packet (may be <code>null</code> if not
102 * specified). Each invocation of this method returns a new clone to
103 * protect against subsequent modification.
104 */
105 byte[] getKeyPacket();
106
107 /**
108 * Returns an {@link Collections#unmodifiableList unmodifiable list}
109 * of {@link XMLStructure}s representing elements from an external
110 * namespace.
111 *
112 * @return an unmodifiable list of <code>XMLStructure</code>s (may be
113 * empty, but never <code>null</code>)
114 */
115 List getExternalElements();
116 }
|