mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 12:02:05 +01:00
Merge pull request #505 from vanitasvitae/bumpPgpainless
Bump PGPainless to 0.2.19
This commit is contained in:
commit
18b25902c4
4 changed files with 32 additions and 13 deletions
|
@ -8,9 +8,10 @@ dependencies {
|
|||
api project(':smack-extensions')
|
||||
api project(':smack-experimental')
|
||||
|
||||
api 'org.pgpainless:pgpainless-core:0.2.8'
|
||||
api 'org.pgpainless:pgpainless-core:0.2.19'
|
||||
|
||||
testImplementation "org.bouncycastle:bcprov-jdk15on:${bouncyCastleVersion}"
|
||||
testImplementation 'ch.qos.logback:logback-classic:1.2.6'
|
||||
|
||||
testFixturesApi(testFixtures(project(":smack-core")))
|
||||
testImplementation group: 'commons-io', name: 'commons-io', version: "$commonsIoVersion"
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.jivesoftware.smack.XMPPConnection;
|
|||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.util.Objects;
|
||||
import org.jivesoftware.smack.util.stringencoder.Base64;
|
||||
|
||||
import org.jivesoftware.smackx.ox.OpenPgpContact;
|
||||
import org.jivesoftware.smackx.ox.OpenPgpMessage;
|
||||
import org.jivesoftware.smackx.ox.OpenPgpSelf;
|
||||
|
@ -90,7 +89,7 @@ public class PainlessOpenPgpProvider implements OpenPgpProvider {
|
|||
|
||||
SigningOptions signOpts = new SigningOptions();
|
||||
signOpts.addInlineSignature(getStore().getKeyRingProtector(), self.getSigningKeyRing(),
|
||||
"xmpp:" + self.getJid().toString(), DocumentSignatureType.BINARY_DOCUMENT);
|
||||
DocumentSignatureType.BINARY_DOCUMENT);
|
||||
|
||||
EncryptionStream cipherStream = PGPainless.encryptAndOrSign()
|
||||
.onOutputStream(cipherText)
|
||||
|
|
|
@ -47,29 +47,27 @@ import org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpStore;
|
|||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.bouncycastle.openpgp.PGPPublicKeyRing;
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.jxmpp.jid.BareJid;
|
||||
import org.jxmpp.jid.Jid;
|
||||
import org.jxmpp.jid.JidTestUtil;
|
||||
import org.pgpainless.key.OpenPgpFingerprint;
|
||||
import org.pgpainless.key.OpenPgpV4Fingerprint;
|
||||
import org.pgpainless.key.protection.UnprotectedKeysProtector;
|
||||
import org.pgpainless.key.util.KeyRingUtils;
|
||||
|
||||
public class PainlessOpenPgpProviderTest extends SmackTestSuite {
|
||||
|
||||
private static final File storagePath;
|
||||
private static File storagePath;
|
||||
private static final BareJid alice = JidTestUtil.BARE_JID_1;
|
||||
private static final BareJid bob = JidTestUtil.BARE_JID_2;
|
||||
|
||||
static {
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void deletePath() throws IOException {
|
||||
storagePath = new File(org.apache.commons.io.FileUtils.getTempDirectory(), "smack-painlessprovidertest");
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
@AfterClass
|
||||
public static void deletePath() throws IOException {
|
||||
org.apache.commons.io.FileUtils.deleteDirectory(storagePath);
|
||||
}
|
||||
|
||||
|
@ -142,7 +140,7 @@ public class PainlessOpenPgpProviderTest extends SmackTestSuite {
|
|||
// Decrypt and Verify
|
||||
decrypted = bobProvider.decryptAndOrVerify(bobConnection, encrypted.getElement(), bobSelf, aliceForBob);
|
||||
|
||||
OpenPgpV4Fingerprint decryptionFingerprint = decrypted.getMetadata().getDecryptionKey().getFingerprint();
|
||||
OpenPgpFingerprint decryptionFingerprint = decrypted.getMetadata().getDecryptionKey().getFingerprint();
|
||||
assertTrue(bobSelf.getSecretKeys().contains(decryptionFingerprint.getKeyId()));
|
||||
assertTrue(decrypted.getMetadata().containsVerifiedSignatureFrom(alicePubKeys));
|
||||
|
||||
|
|
21
smack-openpgp/src/test/resources/logback-test.xml
Normal file
21
smack-openpgp/src/test/resources/logback-test.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<target>System.out</target>
|
||||
<encoder>
|
||||
<pattern>%blue(%-5level) %green(%logger{35}) - %msg %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<target>System.err</target>
|
||||
<encoder>
|
||||
<pattern>%blue(%-5level) %green(%logger{35}) - %msg %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="warn">
|
||||
<appender-ref ref="STDERR" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
Loading…
Reference in a new issue