001/**
002 *
003 * Copyright 2017 Florian Schmaus, 2018 Paul Schaub.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.ox.element;
018
019import java.util.Date;
020import java.util.List;
021import java.util.Set;
022
023import org.jivesoftware.smack.packet.ExtensionElement;
024import org.jivesoftware.smack.util.XmlStringBuilder;
025
026import org.jxmpp.jid.Jid;
027
028/**
029 * This class represents an OpenPGP content element which is not encrypted but signed.
030 *
031 * @see <a href="https://xmpp.org/extensions/xep-0373.html#exchange">
032 *     XEP-0373: ยง3.1 Exchanging OpenPGP Encrypted and Signed Data</a>
033 */
034public class SignElement extends OpenPgpContentElement {
035
036    public SignElement(Set<Jid> to, Date timestamp, List<ExtensionElement> payload) {
037        super(to, timestamp, payload);
038    }
039
040    public static final String ELEMENT = "sign";
041
042    @Override
043    public String getElementName() {
044        return ELEMENT;
045    }
046
047    @Override
048    public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
049        XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
050        addCommonXml(xml);
051        xml.closeElement(this);
052        return xml;
053    }
054
055}