001/**
002 *
003 * Copyright 2017-2019 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 encrypted and 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 SigncryptElement extends EncryptedOpenPgpContentElement {
035
036    public static final String ELEMENT = "signcrypt";
037
038    public SigncryptElement(Set<? extends Jid> to, String rpad, Date timestamp, List<ExtensionElement> payload) {
039        super(to, rpad, timestamp, payload);
040    }
041
042    public SigncryptElement(Set<? extends Jid> to, List<ExtensionElement> payload) {
043        super(to, payload);
044    }
045
046    @Override
047    public String getElementName() {
048        return ELEMENT;
049    }
050
051    @Override
052    public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) {
053        XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket();
054        addCommonXml(xml);
055        xml.closeElement(this);
056        return xml;
057    }
058
059}