本文整理汇总了Java中org.kontalk.client.E2EEncryption类的典型用法代码示例。如果您正苦于以下问题:Java E2EEncryption类的具体用法?Java E2EEncryption怎么用?Java E2EEncryption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
E2EEncryption类属于org.kontalk.client包,在下文中一共展示了E2EEncryption类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.kontalk.client.E2EEncryption; //导入依赖的package包/类
private void configure() {
ProviderManager.addIQProvider(Ping.ELEMENT_NAME, Ping.NAMESPACE, new Ping.Provider());
ProviderManager.addIQProvider(UploadInfo.ELEMENT_NAME, UploadInfo.NAMESPACE, new UploadInfo.Provider());
ProviderManager.addIQProvider(VCard4.ELEMENT_NAME, VCard4.NAMESPACE, new VCard4.Provider());
ProviderManager.addIQProvider(BlockingCommand.BLOCKLIST, BlockingCommand.NAMESPACE, new BlockingCommand.Provider());
ProviderManager.addExtensionProvider(StanzaGroupExtension.ELEMENT_NAME, StanzaGroupExtension.NAMESPACE, new StanzaGroupExtension.Provider());
ProviderManager.addExtensionProvider(SentServerReceipt.ELEMENT_NAME, SentServerReceipt.NAMESPACE, new SentServerReceipt.Provider());
ProviderManager.addExtensionProvider(ReceivedServerReceipt.ELEMENT_NAME, ReceivedServerReceipt.NAMESPACE, new ReceivedServerReceipt.Provider());
ProviderManager.addExtensionProvider(ServerReceiptRequest.ELEMENT_NAME, ServerReceiptRequest.NAMESPACE, new ServerReceiptRequest.Provider());
ProviderManager.addExtensionProvider(AckServerReceipt.ELEMENT_NAME, AckServerReceipt.NAMESPACE, new AckServerReceipt.Provider());
ProviderManager.addExtensionProvider(OutOfBandData.ELEMENT_NAME, OutOfBandData.NAMESPACE, new OutOfBandData.Provider());
ProviderManager.addExtensionProvider(BitsOfBinary.ELEMENT_NAME, BitsOfBinary.NAMESPACE, new BitsOfBinary.Provider());
ProviderManager.addExtensionProvider(SubscribePublicKey.ELEMENT_NAME, SubscribePublicKey.NAMESPACE, new SubscribePublicKey.Provider());
ProviderManager.addExtensionProvider(E2EEncryption.ELEMENT_NAME, E2EEncryption.NAMESPACE, new E2EEncryption.Provider());
}
示例2: parseMessageContent
import org.kontalk.client.E2EEncryption; //导入依赖的package包/类
public static MessageContent parseMessageContent(Message m, boolean decrypted) {
MessageContent.Builder builder = new MessageContent.Builder();
// parsing only default body
String plainText = StringUtils.defaultString(m.getBody());
String encrypted = "";
if (!decrypted) {
ExtensionElement e2eExt = m.getExtension(E2EEncryption.ELEMENT_NAME, E2EEncryption.NAMESPACE);
if (e2eExt instanceof E2EEncryption) {
// encryption extension (RFC 3923), decrypted later
encrypted = EncodingUtils.bytesToBase64(((E2EEncryption) e2eExt).getData());
// remove extension before parsing all others
m.removeExtension(E2EEncryption.ELEMENT_NAME, E2EEncryption.NAMESPACE);
}
ExtensionElement openPGPExt = m.getExtension(OpenPGPExtension.ELEMENT_NAME, OpenPGPExtension.NAMESPACE);
if (openPGPExt instanceof OpenPGPExtension) {
if (!encrypted.isEmpty()) {
LOGGER.info("message contains e2e and OpenPGP element, ignoring e2e");
}
encrypted = ((OpenPGPExtension) openPGPExt).getData();
// remove extension before parsing all others
m.removeExtension(OpenPGPExtension.ELEMENT_NAME, OpenPGPExtension.NAMESPACE);
}
}
if (!encrypted.isEmpty()) {
if (!plainText.isEmpty()) {
LOGGER.config("message contains encryption and body (ignoring body): " + plainText);
plainText = "";
}
builder.encrypted(encrypted);
}
addContent(builder, m.getExtensions(), plainText, decrypted);
return builder.build();
}