mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
Merge branch 'master' of github.com:open-keychain/open-keychain
This commit is contained in:
commit
eb33d314c8
@ -25,8 +25,12 @@ import org.junit.runner.RunWith;
|
||||
import org.robolectric.Robolectric;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.shadows.ShadowLog;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
|
||||
import org.sufficientlysecure.keychain.service.OperationResults.SaveKeyringResult;
|
||||
import org.sufficientlysecure.keychain.util.ProgressScaler;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
@ -40,13 +44,13 @@ public class ProviderHelperSaveTest {
|
||||
ShadowLog.stream = System.out;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLongKeyIdCollision() throws Exception {
|
||||
@Test public void testImportCooperPair() throws Exception {
|
||||
|
||||
// insert two keys with same long key id, make sure the second one gets rejected either way!
|
||||
UncachedKeyRing first =
|
||||
readRingFromResource("/cooperpair/9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF.asc");
|
||||
readRingFromResource("/test-keys/cooperpair/9E669861368BCA0BE42DAF7DDDA252EBB8EBE1AF.asc");
|
||||
UncachedKeyRing second =
|
||||
readRingFromResource("/cooperpair/A55120427374F3F7AA5F1166DDA252EBB8EBE1AF.asc");
|
||||
readRingFromResource("/test-keys/cooperpair/A55120427374F3F7AA5F1166DDA252EBB8EBE1AF.asc");
|
||||
|
||||
SaveKeyringResult result;
|
||||
|
||||
@ -66,6 +70,41 @@ public class ProviderHelperSaveTest {
|
||||
|
||||
}
|
||||
|
||||
@Test public void testImportDivertToCard() throws Exception {
|
||||
|
||||
UncachedKeyRing pub =
|
||||
readRingFromResource("/test-keys/divert_to_card_pub.asc");
|
||||
UncachedKeyRing sec =
|
||||
readRingFromResource("/test-keys/divert_to_card_sec.asc");
|
||||
long keyId = sec.getMasterKeyId();
|
||||
|
||||
SaveKeyringResult result;
|
||||
|
||||
// insert both keys, second should fail
|
||||
result = new ProviderHelper(Robolectric.application).savePublicKeyRing(pub);
|
||||
Assert.assertTrue("import of public keyring should succeed", result.success());
|
||||
result = new ProviderHelper(Robolectric.application).saveSecretKeyRing(sec,
|
||||
new ProgressScaler());
|
||||
Assert.assertTrue("import of secret keyring should succeed", result.success());
|
||||
|
||||
CanonicalizedSecretKeyRing secRing =
|
||||
new ProviderHelper(Robolectric.application).getCanonicalizedSecretKeyRing(keyId);
|
||||
for (CanonicalizedSecretKey key : secRing.secretKeyIterator()) {
|
||||
Assert.assertEquals("all subkeys should be divert-to-key",
|
||||
SecretKeyType.DIVERT_TO_CARD, key.getSecretKeyType());
|
||||
}
|
||||
|
||||
/*
|
||||
CachedPublicKeyRing cachedRing =
|
||||
new ProviderHelper(Robolectric.application).getCachedPublicKeyRing(keyId);
|
||||
for (CanonicalizedSecretKey key : cachedRing.()) {
|
||||
Assert.assertEquals("all subkeys should be divert-to-key",
|
||||
SecretKeyType.DIVERT_TO_CARD, key.getSecretKeyType());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
UncachedKeyRing readRingFromResource(String name) throws Exception {
|
||||
return UncachedKeyRing.fromStream(ProviderHelperSaveTest.class.getResourceAsStream(name)).next();
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.4.12 (GNU/Linux)
|
||||
|
||||
mQENBFPHw2oBCAC3GlG03VJ2axLekrafwFuTZOysS30rTpUF5yrJC9XHgV/W7/Hk
|
||||
QAWKMOwPcOVRiuBwUgHKcn9Oy/pBBzu0kSF/ttMUe9wOFwEkants2Yap87hRa5po
|
||||
g7lCgtvmKBE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Ik1Lf0F2Pg87dxSfhR+9lJoJnim7waWFCbjNWT1nuTG/30TJPjN6wUG0iQ7zDws
|
||||
kxBJy+FusWaB64CzA6bGWzmT3PxLN2Hmc2xWI5Xn/3Iho6jaVt6mypmBU3ybn7lt
|
||||
zMft9oTiVHQxJGwk2faA3Qv+JI3I4kLwYezEteIZEPkr04Zt5/HiU3Rg9DZsKKWp
|
||||
4En/LdYj1T4I01bkZQ4jDPCcvEqkYg==
|
||||
=jzux
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
@ -1,45 +1,3 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.4.12 (GNU/Linux)
|
||||
|
||||
mQENBFPHw2oBCAC3GlG03VJ2axLekrafwFuTZOysS30rTpUF5yrJC9XHgV/W7/Hk
|
||||
QAWKMOwPcOVRiuBwUgHKcn9Oy/pBBzu0kSF/ttMUe9wOFwEkants2Yap87hRa5po
|
||||
g7lCgtvmKBE6qEPr0EcTKzUif+UcPBXpRs74BtJyaMLQgA3C+wPDZ1MTWf9rkRTp
|
||||
lif7xnAClP89yYvhV9KwDYostVxzc7eCe0hrYXXZjN68z30l1aPxbJbzliTrXFyX
|
||||
w6m4KZsd07dY1rRlamJIMI0HUgCYTPDoJAv8ezpYern1bebb2TEAqsEn6QPJHSHz
|
||||
dbXvPk4PEtor7c8J3H47aaBInVsAulUWDCpNABEBAAG0JUhlcmJlcnQgTXVlbGxl
|
||||
ciA8aGVyYmVydEBleGFtcGxlLmNvbT6JATgEEwECACIFAlPHw2oCGwMGCwkIBwMC
|
||||
BhUIAgkKCwQWAgMBAh4BAheAAAoJEEy26QP/37flyT0IALTxtXfYtgTDGxZLgUp4
|
||||
YOgTF03ghaL8ZdL5aNibkPEFgh4cLmLYr92x05JSzrHz73T5TWUG/0iEOfm2P04k
|
||||
YTjDj1uUZMXp0qGQor2/DHNmGALfpxSCVtSWN9GG7QNFffJmZ3U4gQbbhS9ydHTv
|
||||
uecxCL/T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7CRIoDD+LEEIY0BJ0Cre5RZXzUA5dhA2
|
||||
z9axKDtKMUMqwwTPN1DpePzkFgAzmAh7NcpGXTfBkPmtUnkudyZWgQgq19ycspPd
|
||||
GnWNAqsw5ghtzQsfebRibqlTwEkwZMwXSqnD8o7NkZntUwhCSQY+AosAP+16rHkb
|
||||
5uM1grTfAFkx8MW+Idv6zkgn1BvWHnJDEoN3bPTOt36bgsGEuHgzcpDCLkdQXx2G
|
||||
NWAkdJFfTJwb48/+YilF8gC+4RzKftvwVqD8muoINNEXW0LvgYTLM6P7UXd7Fd5v
|
||||
Xtg2iX+bzg2y35cEm7XVABEBAAGJAR8EGAECAAkFAlPHw2oCGwwACgkQTLbpA//f
|
||||
t+VoCAf+Mm7INmrtS9EbXJZBQvkohyuk0TymI/GV4nng5bBeEuW2xE+3ppnBOTUL
|
||||
J2tlpgboIcVoKcXNKYNiw08bGSMSpFPzpyPZDHqau2fiGUlmZl9Pft4yWgoqCB7K
|
||||
cIk1Lf0F2Pg87dxSfhR+9lJoJnim7waWFCbjNWT1nuTG/30TJPjN6wUG0iQ7zDws
|
||||
kxBJy+FusWaB64CzA6bGWzmT3PxLN2Hmc2xWI5Xn/3Iho6jaVt6mypmBU3ybn7lt
|
||||
zMft9oTiVHQxJGwk2faA3Qv+JI3I4kLwYezEteIZEPkr04Zt5/HiU3Rg9DZsKKWp
|
||||
4En/LdYj1T4I01bkZQ4jDPCcvEqkYg==
|
||||
=jzux
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
||||
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
Version: GnuPG v1.4.12 (GNU/Linux)
|
||||
|
Loading…
Reference in New Issue
Block a user