Smack/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpProvider.java

53 lines
1.9 KiB
Java
Raw Normal View History

/**
*
* Copyright 2017 Florian Schmaus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smackx.ox;
import java.io.InputStream;
import java.util.Set;
import org.jivesoftware.smackx.ox.element.OpenPgpElement;
2018-05-21 12:44:27 +02:00
import org.jivesoftware.smackx.ox.element.PubkeyElement;
2018-05-21 15:42:04 +02:00
import org.jivesoftware.smackx.ox.element.PublicKeysListElement;
2018-05-21 20:07:17 +02:00
import org.jivesoftware.smackx.ox.exception.CorruptedOpenPgpKeyException;
import org.jxmpp.jid.BareJid;
public interface OpenPgpProvider {
OpenPgpMessage decryptAndVerify(OpenPgpElement element, BareJid sender) throws Exception;
OpenPgpElement signAndEncrypt(InputStream inputStream, Set<BareJid> recipients) throws Exception;
2018-05-21 12:44:27 +02:00
2018-05-21 15:42:04 +02:00
OpenPgpElement sign(InputStream inputStream) throws Exception;
OpenPgpElement encrypt(InputStream inputStream, Set<BareJid> recipients) throws Exception;
2018-05-21 20:07:17 +02:00
PubkeyElement createPubkeyElement() throws CorruptedOpenPgpKeyException;
2018-05-21 12:44:27 +02:00
2018-05-21 20:07:17 +02:00
void processPubkeyElement(PubkeyElement element, BareJid from) throws CorruptedOpenPgpKeyException;
2018-05-21 12:44:27 +02:00
2018-05-21 15:42:04 +02:00
void processPublicKeysListElement(PublicKeysListElement listElement, BareJid from) throws Exception;
2018-05-21 12:44:27 +02:00
/**
* Return the OpenPGP v4-fingerprint of our key in hexadecimal upper case.
*
* @return fingerprint
2018-05-21 20:07:17 +02:00
* @throws CorruptedOpenPgpKeyException if for some reason the fingerprint cannot be derived from the key pair.
2018-05-21 12:44:27 +02:00
*/
2018-05-21 20:07:17 +02:00
String getFingerprint() throws CorruptedOpenPgpKeyException;
}