Rename Repo's pubkey to signingCertificate

Updates #37.
This commit is contained in:
Daniel Martí 2016-04-19 12:11:54 +01:00
parent 0ec9689a6c
commit 865d537745
10 changed files with 41 additions and 41 deletions

View File

@ -291,7 +291,7 @@ public class ApkProviderTest extends BaseApkProviderTest {
RepoProvider.DataColumns.ADDRESS, RepoProvider.DataColumns.ADDRESS,
RepoProvider.DataColumns.FINGERPRINT, RepoProvider.DataColumns.FINGERPRINT,
RepoProvider.DataColumns.NAME, RepoProvider.DataColumns.NAME,
RepoProvider.DataColumns.PUBLIC_KEY, RepoProvider.DataColumns.SIGNING_CERT,
}; };
for (String field : repoFields) { for (String field : repoFields) {

View File

@ -405,12 +405,12 @@ public class MultiRepoUpdaterTest extends InstrumentationTestCase {
private RepoUpdater createUpdater(String name, Context context) { private RepoUpdater createUpdater(String name, Context context) {
Repo repo = new Repo(); Repo repo = new Repo();
repo.pubkey = PUB_KEY; repo.signingCertificate = PUB_KEY;
repo.address = UUID.randomUUID().toString(); repo.address = UUID.randomUUID().toString();
repo.name = name; repo.name = name;
ContentValues values = new ContentValues(2); ContentValues values = new ContentValues(2);
values.put(RepoProvider.DataColumns.PUBLIC_KEY, repo.pubkey); values.put(RepoProvider.DataColumns.SIGNING_CERT, repo.signingCertificate);
values.put(RepoProvider.DataColumns.ADDRESS, repo.address); values.put(RepoProvider.DataColumns.ADDRESS, repo.address);
values.put(RepoProvider.DataColumns.NAME, repo.name); values.put(RepoProvider.DataColumns.NAME, repo.name);

View File

@ -24,7 +24,7 @@ public class RepoUpdaterTest {
private RepoUpdater repoUpdater; private RepoUpdater repoUpdater;
private File testFilesDir; private File testFilesDir;
String simpleIndexPubkey = "308201ee30820157a0030201020204300d845b300d06092a864886f70d01010b0500302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e301e170d3134303432373030303633315a170d3431303931323030303633315a302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e30819f300d06092a864886f70d010101050003818d0030818902818100a439472e4b6d01141bfc94ecfe131c7c728fdda670bb14c57ca60bd1c38a8b8bc0879d22a0a2d0bc0d6fdd4cb98d1d607c2caefbe250a0bd0322aedeb365caf9b236992fac13e6675d3184a6c7c6f07f73410209e399a9da8d5d7512bbd870508eebacff8b57c3852457419434d34701ccbf692267cbc3f42f1c5d1e23762d790203010001a321301f301d0603551d0e041604140b1840691dab909746fde4bfe28207d1cae15786300d06092a864886f70d01010b05000381810062424c928ffd1b6fd419b44daafef01ca982e09341f7077fb865905087aeac882534b3bd679b51fdfb98892cef38b63131c567ed26c9d5d9163afc775ac98ad88c405d211d6187bde0b0d236381cc574ba06ef9080721a92ae5a103a7301b2c397eecc141cc850dd3e123813ebc41c59d31ddbcb6e984168280c53272f6a442b"; String simpleIndexSigningCert = "308201ee30820157a0030201020204300d845b300d06092a864886f70d01010b0500302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e301e170d3134303432373030303633315a170d3431303931323030303633315a302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e30819f300d06092a864886f70d010101050003818d0030818902818100a439472e4b6d01141bfc94ecfe131c7c728fdda670bb14c57ca60bd1c38a8b8bc0879d22a0a2d0bc0d6fdd4cb98d1d607c2caefbe250a0bd0322aedeb365caf9b236992fac13e6675d3184a6c7c6f07f73410209e399a9da8d5d7512bbd870508eebacff8b57c3852457419434d34701ccbf692267cbc3f42f1c5d1e23762d790203010001a321301f301d0603551d0e041604140b1840691dab909746fde4bfe28207d1cae15786300d06092a864886f70d01010b05000381810062424c928ffd1b6fd419b44daafef01ca982e09341f7077fb865905087aeac882534b3bd679b51fdfb98892cef38b63131c567ed26c9d5d9163afc775ac98ad88c405d211d6187bde0b0d236381cc574ba06ef9080721a92ae5a103a7301b2c397eecc141cc850dd3e123813ebc41c59d31ddbcb6e984168280c53272f6a442b";
@Before @Before
public void setUp() { public void setUp() {
@ -32,7 +32,7 @@ public class RepoUpdaterTest {
context = instrumentation.getContext(); context = instrumentation.getContext();
testFilesDir = TestUtils.getWriteableDir(instrumentation); testFilesDir = TestUtils.getWriteableDir(instrumentation);
Repo repo = new Repo(); Repo repo = new Repo();
repo.pubkey = this.simpleIndexPubkey; repo.signingCertificate = this.simpleIndexSigningCert;
repoUpdater = new RepoUpdater(context, repo); repoUpdater = new RepoUpdater(context, repo);
} }

View File

@ -35,13 +35,13 @@ import static org.junit.Assert.fail;
public class RepoXMLHandlerTest { public class RepoXMLHandlerTest {
private static final String TAG = "RepoXMLHandlerTest"; private static final String TAG = "RepoXMLHandlerTest";
private static final String FAKE_PUBKEY = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345"; private static final String FAKE_SIGNING_CERT = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345";
@Test @Test
public void testSimpleIndex() { public void testSimpleIndex() {
Repo expectedRepo = new Repo(); Repo expectedRepo = new Repo();
expectedRepo.name = "F-Droid"; expectedRepo.name = "F-Droid";
expectedRepo.pubkey = "308201ee30820157a0030201020204300d845b300d06092a864886f70d01010b0500302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e301e170d3134303432373030303633315a170d3431303931323030303633315a302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e30819f300d06092a864886f70d010101050003818d0030818902818100a439472e4b6d01141bfc94ecfe131c7c728fdda670bb14c57ca60bd1c38a8b8bc0879d22a0a2d0bc0d6fdd4cb98d1d607c2caefbe250a0bd0322aedeb365caf9b236992fac13e6675d3184a6c7c6f07f73410209e399a9da8d5d7512bbd870508eebacff8b57c3852457419434d34701ccbf692267cbc3f42f1c5d1e23762d790203010001a321301f301d0603551d0e041604140b1840691dab909746fde4bfe28207d1cae15786300d06092a864886f70d01010b05000381810062424c928ffd1b6fd419b44daafef01ca982e09341f7077fb865905087aeac882534b3bd679b51fdfb98892cef38b63131c567ed26c9d5d9163afc775ac98ad88c405d211d6187bde0b0d236381cc574ba06ef9080721a92ae5a103a7301b2c397eecc141cc850dd3e123813ebc41c59d31ddbcb6e984168280c53272f6a442b"; expectedRepo.signingCertificate = "308201ee30820157a0030201020204300d845b300d06092a864886f70d01010b0500302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e301e170d3134303432373030303633315a170d3431303931323030303633315a302a3110300e060355040b1307462d44726f6964311630140603550403130d70616c6174736368696e6b656e30819f300d06092a864886f70d010101050003818d0030818902818100a439472e4b6d01141bfc94ecfe131c7c728fdda670bb14c57ca60bd1c38a8b8bc0879d22a0a2d0bc0d6fdd4cb98d1d607c2caefbe250a0bd0322aedeb365caf9b236992fac13e6675d3184a6c7c6f07f73410209e399a9da8d5d7512bbd870508eebacff8b57c3852457419434d34701ccbf692267cbc3f42f1c5d1e23762d790203010001a321301f301d0603551d0e041604140b1840691dab909746fde4bfe28207d1cae15786300d06092a864886f70d01010b05000381810062424c928ffd1b6fd419b44daafef01ca982e09341f7077fb865905087aeac882534b3bd679b51fdfb98892cef38b63131c567ed26c9d5d9163afc775ac98ad88c405d211d6187bde0b0d236381cc574ba06ef9080721a92ae5a103a7301b2c397eecc141cc850dd3e123813ebc41c59d31ddbcb6e984168280c53272f6a442b";
expectedRepo.description = "The official repository of the F-Droid client. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitorious.org/f-droid."; expectedRepo.description = "The official repository of the F-Droid client. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitorious.org/f-droid.";
RepoDetails actualDetails = getFromFile("simpleIndex.xml"); RepoDetails actualDetails = getFromFile("simpleIndex.xml");
handlerTestSuite(expectedRepo, actualDetails, 0, 0, -1, 12); handlerTestSuite(expectedRepo, actualDetails, 0, 0, -1, 12);
@ -51,7 +51,7 @@ public class RepoXMLHandlerTest {
public void testSmallRepo() { public void testSmallRepo() {
Repo expectedRepo = new Repo(); Repo expectedRepo = new Repo();
expectedRepo.name = "Android-Nexus-7-20139453 on UNSET"; expectedRepo.name = "Android-Nexus-7-20139453 on UNSET";
expectedRepo.pubkey = "308202da308201c2a00302010202080eb08c796fec91aa300d06092a864886f70d0101050500302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a656374301e170d3134313030333135303631325a170d3135313030333135303631325a302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a0282010100c7ab44b130be5c00eedcc3625462f6f6ac26e502641cd641f3e30cbb0ff1ba325158611e7fc2448a35b6a6df30dc6e23602cf6909448befcf11e2fe486b580f1e76fe5887d159050d00afd2c4079f6538896bb200627f4b3e874f011ce5df0fef5d150fcb0b377b531254e436eaf4083ea72fe3b8c3ef450789fa858f2be8f6c5335bb326aff3dda689fbc7b5ba98dea53651dbea7452c38d294985ac5dd8a9e491a695de92c706d682d6911411fcaef3b0a08a030fe8a84e47acaab0b7edcda9d190ce39e810b79b1d8732eca22b15f0d048c8d6f00503a7ee81ab6e08919ff465883432304d95238b95e95c5f74e0a421809e2a6a85825aed680e0d6939e8f0203010001300d06092a864886f70d010105050003820101006d17aad3271b8b2c299dbdb7b1182849b0d5ddb9f1016dcb3487ae0db02b6be503344c7d066e2050bcd01d411b5ee78c7ed450f0ff9da5ce228f774cbf41240361df53d9c6078159d16f4d34379ab7dedf6186489397c83b44b964251a2ebb42b7c4689a521271b1056d3b5a5fa8f28ba64fb8ce5e2226c33c45d27ba3f632dc266c12abf582b8438c2abcf3eae9de9f31152b4158ace0ef33435c20eb809f1b3988131db6e5a1442f2617c3491d9565fedb3e320e8df4236200d3bd265e47934aa578f84d0d1a5efeb49b39907e876452c46996d0feff9404b41aa5631b4482175d843d5512ded45e12a514690646492191e7add434afce63dbff8f0b03ec0c"; expectedRepo.signingCertificate = "308202da308201c2a00302010202080eb08c796fec91aa300d06092a864886f70d0101050500302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a656374301e170d3134313030333135303631325a170d3135313030333135303631325a302d3111300f060355040a0c084b6572706c61707031183016060355040b0c0f477561726469616e50726f6a65637430820122300d06092a864886f70d01010105000382010f003082010a0282010100c7ab44b130be5c00eedcc3625462f6f6ac26e502641cd641f3e30cbb0ff1ba325158611e7fc2448a35b6a6df30dc6e23602cf6909448befcf11e2fe486b580f1e76fe5887d159050d00afd2c4079f6538896bb200627f4b3e874f011ce5df0fef5d150fcb0b377b531254e436eaf4083ea72fe3b8c3ef450789fa858f2be8f6c5335bb326aff3dda689fbc7b5ba98dea53651dbea7452c38d294985ac5dd8a9e491a695de92c706d682d6911411fcaef3b0a08a030fe8a84e47acaab0b7edcda9d190ce39e810b79b1d8732eca22b15f0d048c8d6f00503a7ee81ab6e08919ff465883432304d95238b95e95c5f74e0a421809e2a6a85825aed680e0d6939e8f0203010001300d06092a864886f70d010105050003820101006d17aad3271b8b2c299dbdb7b1182849b0d5ddb9f1016dcb3487ae0db02b6be503344c7d066e2050bcd01d411b5ee78c7ed450f0ff9da5ce228f774cbf41240361df53d9c6078159d16f4d34379ab7dedf6186489397c83b44b964251a2ebb42b7c4689a521271b1056d3b5a5fa8f28ba64fb8ce5e2226c33c45d27ba3f632dc266c12abf582b8438c2abcf3eae9de9f31152b4158ace0ef33435c20eb809f1b3988131db6e5a1442f2617c3491d9565fedb3e320e8df4236200d3bd265e47934aa578f84d0d1a5efeb49b39907e876452c46996d0feff9404b41aa5631b4482175d843d5512ded45e12a514690646492191e7add434afce63dbff8f0b03ec0c";
expectedRepo.description = "A local FDroid repo generated from apps installed on Android-Nexus-7-20139453"; expectedRepo.description = "A local FDroid repo generated from apps installed on Android-Nexus-7-20139453";
RepoDetails actualDetails = getFromFile("smallRepo.xml"); RepoDetails actualDetails = getFromFile("smallRepo.xml");
handlerTestSuite(expectedRepo, actualDetails, 12, 12, 14, -1); handlerTestSuite(expectedRepo, actualDetails, 12, 12, 14, -1);
@ -75,7 +75,7 @@ public class RepoXMLHandlerTest {
public void testMediumRepo() { public void testMediumRepo() {
Repo expectedRepo = new Repo(); Repo expectedRepo = new Repo();
expectedRepo.name = "Guardian Project Official Releases"; expectedRepo.name = "Guardian Project Official Releases";
expectedRepo.pubkey = "308205d8308203c0020900a397b4da7ecda034300d06092a864886f70d01010505003081ad310b30090603550406130255533111300f06035504080c084e657720596f726b3111300f06035504070c084e657720596f726b31143012060355040b0c0b4644726f6964205265706f31193017060355040a0c10477561726469616e2050726f6a656374311d301b06035504030c14677561726469616e70726f6a6563742e696e666f3128302606092a864886f70d0109011619726f6f7440677561726469616e70726f6a6563742e696e666f301e170d3134303632363139333931385a170d3431313131303139333931385a3081ad310b30090603550406130255533111300f06035504080c084e657720596f726b3111300f06035504070c084e657720596f726b31143012060355040b0c0b4644726f6964205265706f31193017060355040a0c10477561726469616e2050726f6a656374311d301b06035504030c14677561726469616e70726f6a6563742e696e666f3128302606092a864886f70d0109011619726f6f7440677561726469616e70726f6a6563742e696e666f30820222300d06092a864886f70d01010105000382020f003082020a0282020100b3cd79121b9b883843be3c4482e320809106b0a23755f1dd3c7f46f7d315d7bb2e943486d61fc7c811b9294dcc6b5baac4340f8db2b0d5e14749e7f35e1fc211fdbc1071b38b4753db201c314811bef885bd8921ad86facd6cc3b8f74d30a0b6e2e6e576f906e9581ef23d9c03e926e06d1f033f28bd1e21cfa6a0e3ff5c9d8246cf108d82b488b9fdd55d7de7ebb6a7f64b19e0d6b2ab1380a6f9d42361770d1956701a7f80e2de568acd0bb4527324b1e0973e89595d91c8cc102d9248525ae092e2c9b69f7414f724195b81427f28b1d3d09a51acfe354387915fd9521e8c890c125fc41a12bf34d2a1b304067ab7251e0e9ef41833ce109e76963b0b256395b16b886bca21b831f1408f836146019e7908829e716e72b81006610a2af08301de5d067c9e114a1e5759db8a6be6a3cc2806bcfe6fafd41b5bc9ddddb3dc33d6f605b1ca7d8a9e0ecdd6390d38906649e68a90a717bea80fa220170eea0c86fc78a7e10dac7b74b8e62045a3ecca54e035281fdc9fe5920a855fde3c0be522e3aef0c087524f13d973dff3768158b01a5800a060c06b451ec98d627dd052eda804d0556f60dbc490d94e6e9dea62ffcafb5beffbd9fc38fb2f0d7050004fe56b4dda0a27bc47554e1e0a7d764e17622e71f83a475db286bc7862deee1327e2028955d978272ea76bf0b88e70a18621aba59ff0c5993ef5f0e5d6b6b98e68b70203010001300d06092a864886f70d0101050500038202010079c79c8ef408a20d243d8bd8249fb9a48350dc19663b5e0fce67a8dbcb7de296c5ae7bbf72e98a2020fb78f2db29b54b0e24b181aa1c1d333cc0303685d6120b03216a913f96b96eb838f9bff125306ae3120af838c9fc07ebb5100125436bd24ec6d994d0bff5d065221871f8410daf536766757239bf594e61c5432c9817281b985263bada8381292e543a49814061ae11c92a316e7dc100327b59e3da90302c5ada68c6a50201bda1fcce800b53f381059665dbabeeb0b50eb22b2d7d2d9b0aa7488ca70e67ac6c518adb8e78454a466501e89d81a45bf1ebc350896f2c3ae4b6679ecfbf9d32960d4f5b493125c7876ef36158562371193f600bc511000a67bdb7c664d018f99d9e589868d103d7e0994f166b2ba18ff7e67d8c4da749e44dfae1d930ae5397083a51675c409049dfb626a96246c0015ca696e94ebb767a20147834bf78b07fece3f0872b057c1c519ff882501995237d8206b0b3832f78753ebd8dcbd1d3d9f5ba733538113af6b407d960ec4353c50eb38ab29888238da843cd404ed8f4952f59e4bbc0035fc77a54846a9d419179c46af1b4a3b7fc98e4d312aaa29b9b7d79e739703dc0fa41c7280d5587709277ffa11c3620f5fba985b82c238ba19b17ebd027af9424be0941719919f620dd3bb3c3f11638363708aa11f858e153cf3a69bce69978b90e4a273836100aa1e617ba455cd00426847f"; expectedRepo.signingCertificate = "308205d8308203c0020900a397b4da7ecda034300d06092a864886f70d01010505003081ad310b30090603550406130255533111300f06035504080c084e657720596f726b3111300f06035504070c084e657720596f726b31143012060355040b0c0b4644726f6964205265706f31193017060355040a0c10477561726469616e2050726f6a656374311d301b06035504030c14677561726469616e70726f6a6563742e696e666f3128302606092a864886f70d0109011619726f6f7440677561726469616e70726f6a6563742e696e666f301e170d3134303632363139333931385a170d3431313131303139333931385a3081ad310b30090603550406130255533111300f06035504080c084e657720596f726b3111300f06035504070c084e657720596f726b31143012060355040b0c0b4644726f6964205265706f31193017060355040a0c10477561726469616e2050726f6a656374311d301b06035504030c14677561726469616e70726f6a6563742e696e666f3128302606092a864886f70d0109011619726f6f7440677561726469616e70726f6a6563742e696e666f30820222300d06092a864886f70d01010105000382020f003082020a0282020100b3cd79121b9b883843be3c4482e320809106b0a23755f1dd3c7f46f7d315d7bb2e943486d61fc7c811b9294dcc6b5baac4340f8db2b0d5e14749e7f35e1fc211fdbc1071b38b4753db201c314811bef885bd8921ad86facd6cc3b8f74d30a0b6e2e6e576f906e9581ef23d9c03e926e06d1f033f28bd1e21cfa6a0e3ff5c9d8246cf108d82b488b9fdd55d7de7ebb6a7f64b19e0d6b2ab1380a6f9d42361770d1956701a7f80e2de568acd0bb4527324b1e0973e89595d91c8cc102d9248525ae092e2c9b69f7414f724195b81427f28b1d3d09a51acfe354387915fd9521e8c890c125fc41a12bf34d2a1b304067ab7251e0e9ef41833ce109e76963b0b256395b16b886bca21b831f1408f836146019e7908829e716e72b81006610a2af08301de5d067c9e114a1e5759db8a6be6a3cc2806bcfe6fafd41b5bc9ddddb3dc33d6f605b1ca7d8a9e0ecdd6390d38906649e68a90a717bea80fa220170eea0c86fc78a7e10dac7b74b8e62045a3ecca54e035281fdc9fe5920a855fde3c0be522e3aef0c087524f13d973dff3768158b01a5800a060c06b451ec98d627dd052eda804d0556f60dbc490d94e6e9dea62ffcafb5beffbd9fc38fb2f0d7050004fe56b4dda0a27bc47554e1e0a7d764e17622e71f83a475db286bc7862deee1327e2028955d978272ea76bf0b88e70a18621aba59ff0c5993ef5f0e5d6b6b98e68b70203010001300d06092a864886f70d0101050500038202010079c79c8ef408a20d243d8bd8249fb9a48350dc19663b5e0fce67a8dbcb7de296c5ae7bbf72e98a2020fb78f2db29b54b0e24b181aa1c1d333cc0303685d6120b03216a913f96b96eb838f9bff125306ae3120af838c9fc07ebb5100125436bd24ec6d994d0bff5d065221871f8410daf536766757239bf594e61c5432c9817281b985263bada8381292e543a49814061ae11c92a316e7dc100327b59e3da90302c5ada68c6a50201bda1fcce800b53f381059665dbabeeb0b50eb22b2d7d2d9b0aa7488ca70e67ac6c518adb8e78454a466501e89d81a45bf1ebc350896f2c3ae4b6679ecfbf9d32960d4f5b493125c7876ef36158562371193f600bc511000a67bdb7c664d018f99d9e589868d103d7e0994f166b2ba18ff7e67d8c4da749e44dfae1d930ae5397083a51675c409049dfb626a96246c0015ca696e94ebb767a20147834bf78b07fece3f0872b057c1c519ff882501995237d8206b0b3832f78753ebd8dcbd1d3d9f5ba733538113af6b407d960ec4353c50eb38ab29888238da843cd404ed8f4952f59e4bbc0035fc77a54846a9d419179c46af1b4a3b7fc98e4d312aaa29b9b7d79e739703dc0fa41c7280d5587709277ffa11c3620f5fba985b82c238ba19b17ebd027af9424be0941719919f620dd3bb3c3f11638363708aa11f858e153cf3a69bce69978b90e4a273836100aa1e617ba455cd00426847f";
expectedRepo.description = "The official app repository of The Guardian Project. Applications in this repository are official binaries build by the original application developers and signed by the same key as the APKs that are released in the Google Play store."; expectedRepo.description = "The official app repository of The Guardian Project. Applications in this repository are official binaries build by the original application developers and signed by the same key as the APKs that are released in the Google Play store.";
RepoDetails actualDetails = getFromFile("mediumRepo.xml"); RepoDetails actualDetails = getFromFile("mediumRepo.xml");
handlerTestSuite(expectedRepo, actualDetails, 15, 36, 60, 12); handlerTestSuite(expectedRepo, actualDetails, 15, 36, 60, 12);
@ -102,7 +102,7 @@ public class RepoXMLHandlerTest {
public void testLargeRepo() { public void testLargeRepo() {
Repo expectedRepo = new Repo(); Repo expectedRepo = new Repo();
expectedRepo.name = "F-Droid"; expectedRepo.name = "F-Droid";
expectedRepo.pubkey = "3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef"; expectedRepo.signingCertificate = "3082035e30820246a00302010202044c49cd00300d06092a864886f70d01010505003071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b73301e170d3130303732333137313032345a170d3337313230383137313032345a3071310b300906035504061302554b3110300e06035504081307556e6b6e6f776e3111300f0603550407130857657468657262793110300e060355040a1307556e6b6e6f776e3110300e060355040b1307556e6b6e6f776e311930170603550403131043696172616e2047756c746e69656b7330820122300d06092a864886f70d01010105000382010f003082010a028201010096d075e47c014e7822c89fd67f795d23203e2a8843f53ba4e6b1bf5f2fd0e225938267cfcae7fbf4fe596346afbaf4070fdb91f66fbcdf2348a3d92430502824f80517b156fab00809bdc8e631bfa9afd42d9045ab5fd6d28d9e140afc1300917b19b7c6c4df4a494cf1f7cb4a63c80d734265d735af9e4f09455f427aa65a53563f87b336ca2c19d244fcbba617ba0b19e56ed34afe0b253ab91e2fdb1271f1b9e3c3232027ed8862a112f0706e234cf236914b939bcf959821ecb2a6c18057e070de3428046d94b175e1d89bd795e535499a091f5bc65a79d539a8d43891ec504058acb28c08393b5718b57600a211e803f4a634e5c57f25b9b8c4422c6fd90203010001300d06092a864886f70d0101050500038201010008e4ef699e9807677ff56753da73efb2390d5ae2c17e4db691d5df7a7b60fc071ae509c5414be7d5da74df2811e83d3668c4a0b1abc84b9fa7d96b4cdf30bba68517ad2a93e233b042972ac0553a4801c9ebe07bf57ebe9a3b3d6d663965260e50f3b8f46db0531761e60340a2bddc3426098397fda54044a17e5244549f9869b460ca5e6e216b6f6a2db0580b480ca2afe6ec6b46eedacfa4aa45038809ece0c5978653d6c85f678e7f5a2156d1bedd8117751e64a4b0dcd140f3040b021821a8d93aed8d01ba36db6c82372211fed714d9a32607038cdfd565bd529ffc637212aaa2c224ef22b603eccefb5bf1e085c191d4b24fe742b17ab3f55d4e6f05ef";
expectedRepo.description = "The official FDroid repository. Applications in this repository are mostly built directory from the source code. Some are official binaries built by the original application developers - these will be replaced by source-built versions over time."; expectedRepo.description = "The official FDroid repository. Applications in this repository are mostly built directory from the source code. Some are official binaries built by the original application developers - these will be replaced by source-built versions over time.";
RepoDetails actualDetails = getFromFile("largeRepo.xml"); RepoDetails actualDetails = getFromFile("largeRepo.xml");
handlerTestSuite(expectedRepo, actualDetails, 1211, 2381, 14, 12); handlerTestSuite(expectedRepo, actualDetails, 1211, 2381, 14, 12);
@ -612,9 +612,9 @@ public class RepoXMLHandlerTest {
private void handlerTestSuite(Repo expectedRepo, RepoDetails actualDetails, int appCount, int apkCount, int maxAge, int version) { private void handlerTestSuite(Repo expectedRepo, RepoDetails actualDetails, int appCount, int apkCount, int maxAge, int version) {
assertNotNull(actualDetails); assertNotNull(actualDetails);
assertFalse(TextUtils.isEmpty(actualDetails.signingCert)); assertFalse(TextUtils.isEmpty(actualDetails.signingCert));
assertEquals(expectedRepo.pubkey.length(), actualDetails.signingCert.length()); assertEquals(expectedRepo.signingCertificate.length(), actualDetails.signingCert.length());
assertEquals(expectedRepo.pubkey, actualDetails.signingCert); assertEquals(expectedRepo.signingCertificate, actualDetails.signingCert);
assertFalse(FAKE_PUBKEY.equals(actualDetails.signingCert)); assertFalse(FAKE_SIGNING_CERT.equals(actualDetails.signingCert));
assertFalse(TextUtils.isEmpty(actualDetails.name)); assertFalse(TextUtils.isEmpty(actualDetails.name));
assertEquals(expectedRepo.name.length(), actualDetails.name.length()); assertEquals(expectedRepo.name.length(), actualDetails.name.length());

View File

@ -216,7 +216,7 @@ public class RepoUpdater {
private void assertSigningCertFromXmlCorrect() throws SigningException { private void assertSigningCertFromXmlCorrect() throws SigningException {
// no signing cert read from database, this is the first use // no signing cert read from database, this is the first use
if (repo.pubkey == null) { if (repo.signingCertificate == null) {
verifyAndStoreTOFUCerts(signingCertFromIndexXml, signingCertFromJar); verifyAndStoreTOFUCerts(signingCertFromIndexXml, signingCertFromJar);
} }
verifyCerts(signingCertFromIndexXml, signingCertFromJar); verifyCerts(signingCertFromIndexXml, signingCertFromJar);
@ -308,8 +308,8 @@ public class RepoUpdater {
*/ */
private void verifyAndStoreTOFUCerts(String certFromIndexXml, X509Certificate rawCertFromJar) private void verifyAndStoreTOFUCerts(String certFromIndexXml, X509Certificate rawCertFromJar)
throws SigningException { throws SigningException {
if (repo.pubkey != null) { if (repo.signingCertificate != null) {
return; // there is a repo.pubkey already, nothing to TOFU return; // there is a repo.signingCertificate already, nothing to TOFU
} }
/* The first time a repo is added, it can be added with the signing certificate's /* The first time a repo is added, it can be added with the signing certificate's
@ -328,7 +328,7 @@ public class RepoUpdater {
Utils.debugLog(TAG, "Saving new signing certificate in the database for " + repo.address); Utils.debugLog(TAG, "Saving new signing certificate in the database for " + repo.address);
ContentValues values = new ContentValues(2); ContentValues values = new ContentValues(2);
values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), "")); values.put(RepoProvider.DataColumns.LAST_UPDATED, Utils.formatDate(new Date(), ""));
values.put(RepoProvider.DataColumns.PUBLIC_KEY, Hasher.hex(rawCertFromJar)); values.put(RepoProvider.DataColumns.SIGNING_CERT, Hasher.hex(rawCertFromJar));
RepoProvider.Helper.update(context, repo, values); RepoProvider.Helper.update(context, repo, values);
} }
@ -348,16 +348,16 @@ public class RepoUpdater {
// convert binary data to string version that is used in FDroid's database // convert binary data to string version that is used in FDroid's database
String certFromJar = Hasher.hex(rawCertFromJar); String certFromJar = Hasher.hex(rawCertFromJar);
// repo and repo.pubkey must be pre-loaded from the database // repo and repo.signingCertificate must be pre-loaded from the database
if (TextUtils.isEmpty(repo.pubkey) if (TextUtils.isEmpty(repo.signingCertificate)
|| TextUtils.isEmpty(certFromJar) || TextUtils.isEmpty(certFromJar)
|| TextUtils.isEmpty(certFromIndexXml)) { || TextUtils.isEmpty(certFromIndexXml)) {
throw new SigningException(repo, "A empty repo or signing certificate is invalid!"); throw new SigningException(repo, "A empty repo or signing certificate is invalid!");
} }
// though its called repo.pubkey, its actually a X509 certificate // though its called repo.signingCertificate, its actually a X509 certificate
if (repo.pubkey.equals(certFromJar) if (repo.signingCertificate.equals(certFromJar)
&& repo.pubkey.equals(certFromIndexXml) && repo.signingCertificate.equals(certFromIndexXml)
&& certFromIndexXml.equals(certFromJar)) { && certFromIndexXml.equals(certFromJar)) {
return; // we have a match! return; // we have a match!
} }

View File

@ -252,7 +252,7 @@ class DBHelper extends SQLiteOpenHelper {
values.put(RepoProvider.DataColumns.ADDRESS, address); values.put(RepoProvider.DataColumns.ADDRESS, address);
values.put(RepoProvider.DataColumns.NAME, name); values.put(RepoProvider.DataColumns.NAME, name);
values.put(RepoProvider.DataColumns.DESCRIPTION, description); values.put(RepoProvider.DataColumns.DESCRIPTION, description);
values.put(RepoProvider.DataColumns.PUBLIC_KEY, pubKey); values.put(RepoProvider.DataColumns.SIGNING_CERT, pubKey);
values.put(RepoProvider.DataColumns.FINGERPRINT, Utils.calcFingerprint(pubKey)); values.put(RepoProvider.DataColumns.FINGERPRINT, Utils.calcFingerprint(pubKey));
values.put(RepoProvider.DataColumns.MAX_AGE, 0); values.put(RepoProvider.DataColumns.MAX_AGE, 0);
values.put(RepoProvider.DataColumns.VERSION, version); values.put(RepoProvider.DataColumns.VERSION, version);
@ -311,7 +311,7 @@ class DBHelper extends SQLiteOpenHelper {
Repo repo = new Repo(); Repo repo = new Repo();
repo.address = cursor.getString(0); repo.address = cursor.getString(0);
repo.inuse = cursor.getInt(1) == 1; repo.inuse = cursor.getInt(1) == 1;
repo.pubkey = cursor.getString(2); repo.signingCertificate = cursor.getString(2);
oldrepos.add(repo); oldrepos.add(repo);
cursor.moveToNext(); cursor.moveToNext();
} }
@ -325,7 +325,7 @@ class DBHelper extends SQLiteOpenHelper {
values.put("address", repo.address); values.put("address", repo.address);
values.put("inuse", repo.inuse); values.put("inuse", repo.inuse);
values.put("priority", 10); values.put("priority", 10);
values.put("pubkey", repo.pubkey); values.put("pubkey", repo.signingCertificate);
values.put("lastetag", (String) null); values.put("lastetag", (String) null);
db.insert(TABLE_REPO, null, values); db.insert(TABLE_REPO, null, values);
} }
@ -388,7 +388,7 @@ class DBHelper extends SQLiteOpenHelper {
while (!cursor.isAfterLast()) { while (!cursor.isAfterLast()) {
Repo repo = new Repo(); Repo repo = new Repo();
repo.address = cursor.getString(0); repo.address = cursor.getString(0);
repo.pubkey = cursor.getString(1); repo.signingCertificate = cursor.getString(1);
oldrepos.add(repo); oldrepos.add(repo);
cursor.moveToNext(); cursor.moveToNext();
} }
@ -397,7 +397,7 @@ class DBHelper extends SQLiteOpenHelper {
} }
for (final Repo repo : oldrepos) { for (final Repo repo : oldrepos) {
ContentValues values = new ContentValues(); ContentValues values = new ContentValues();
values.put("fingerprint", Utils.calcFingerprint(repo.pubkey)); values.put("fingerprint", Utils.calcFingerprint(repo.signingCertificate));
db.update(TABLE_REPO, values, "address = ?", new String[] {repo.address}); db.update(TABLE_REPO, values, "address = ?", new String[] {repo.address});
} }
} }

View File

@ -24,7 +24,7 @@ public class Repo extends ValueObject {
public boolean inuse; public boolean inuse;
public int priority; public int priority;
/** The signing certificate, {@code null} for a newly added repo */ /** The signing certificate, {@code null} for a newly added repo */
public String pubkey; public String signingCertificate;
/** /**
* The SHA1 fingerprint of {@link #pubkey}, set to {@code null} when a * The SHA1 fingerprint of {@link #pubkey}, set to {@code null} when a
* newly added repo did not include fingerprint. It should never be an * newly added repo did not include fingerprint. It should never be an
@ -79,8 +79,8 @@ public class Repo extends ValueObject {
case RepoProvider.DataColumns.NAME: case RepoProvider.DataColumns.NAME:
name = cursor.getString(i); name = cursor.getString(i);
break; break;
case RepoProvider.DataColumns.PUBLIC_KEY: case RepoProvider.DataColumns.SIGNING_CERT:
pubkey = cursor.getString(i); signingCertificate = cursor.getString(i);
break; break;
case RepoProvider.DataColumns.PRIORITY: case RepoProvider.DataColumns.PRIORITY:
priority = cursor.getInt(i); priority = cursor.getInt(i);
@ -112,13 +112,13 @@ public class Repo extends ValueObject {
} }
public boolean isSigned() { public boolean isSigned() {
return !TextUtils.isEmpty(this.pubkey); return !TextUtils.isEmpty(this.signingCertificate);
} }
// this happens when a repo is configed with a fingerprint, but the client // this happens when a repo is configed with a fingerprint, but the client
// has not connected to it yet to download its pubkey // has not connected to it yet to download its signing certificate
public boolean isSignedButUnverified() { public boolean isSignedButUnverified() {
return TextUtils.isEmpty(this.pubkey) && !TextUtils.isEmpty(this.fingerprint); return TextUtils.isEmpty(this.signingCertificate) && !TextUtils.isEmpty(this.fingerprint);
} }
public boolean hasBeenUpdated() { public boolean hasBeenUpdated() {
@ -191,8 +191,8 @@ public class Repo extends ValueObject {
name = values.getAsString(RepoProvider.DataColumns.NAME); name = values.getAsString(RepoProvider.DataColumns.NAME);
} }
if (values.containsKey(RepoProvider.DataColumns.PUBLIC_KEY)) { if (values.containsKey(RepoProvider.DataColumns.SIGNING_CERT)) {
pubkey = values.getAsString(RepoProvider.DataColumns.PUBLIC_KEY); signingCertificate = values.getAsString(RepoProvider.DataColumns.SIGNING_CERT);
} }
if (values.containsKey(RepoProvider.DataColumns.PRIORITY)) { if (values.containsKey(RepoProvider.DataColumns.PRIORITY)) {

View File

@ -129,8 +129,8 @@ public class RepoProvider extends FDroidProvider {
* make sure it is correct. If the fingerprint is empty, then store * make sure it is correct. If the fingerprint is empty, then store
* the calculated one. * the calculated one.
*/ */
if (values.containsKey(DataColumns.PUBLIC_KEY)) { if (values.containsKey(DataColumns.SIGNING_CERT)) {
String publicKey = values.getAsString(DataColumns.PUBLIC_KEY); String publicKey = values.getAsString(DataColumns.SIGNING_CERT);
String calcedFingerprint = Utils.calcFingerprint(publicKey); String calcedFingerprint = Utils.calcFingerprint(publicKey);
if (values.containsKey(DataColumns.FINGERPRINT)) { if (values.containsKey(DataColumns.FINGERPRINT)) {
String fingerprint = values.getAsString(DataColumns.FINGERPRINT); String fingerprint = values.getAsString(DataColumns.FINGERPRINT);
@ -216,7 +216,7 @@ public class RepoProvider extends FDroidProvider {
String DESCRIPTION = "description"; String DESCRIPTION = "description";
String IN_USE = "inuse"; String IN_USE = "inuse";
String PRIORITY = "priority"; String PRIORITY = "priority";
String PUBLIC_KEY = "pubkey"; String SIGNING_CERT = "pubkey";
String FINGERPRINT = "fingerprint"; String FINGERPRINT = "fingerprint";
String MAX_AGE = "maxage"; String MAX_AGE = "maxage";
String LAST_ETAG = "lastetag"; String LAST_ETAG = "lastetag";
@ -227,7 +227,7 @@ public class RepoProvider extends FDroidProvider {
String PASSWORD = "password"; String PASSWORD = "password";
String[] ALL = { String[] ALL = {
_ID, ADDRESS, NAME, DESCRIPTION, IN_USE, PRIORITY, PUBLIC_KEY, _ID, ADDRESS, NAME, DESCRIPTION, IN_USE, PRIORITY, SIGNING_CERT,
FINGERPRINT, MAX_AGE, LAST_UPDATED, LAST_ETAG, VERSION, IS_SWAP, FINGERPRINT, MAX_AGE, LAST_UPDATED, LAST_ETAG, VERSION, IS_SWAP,
USERNAME, PASSWORD, USERNAME, PASSWORD,
}; };

View File

@ -711,7 +711,7 @@ public class ManageReposActivity extends ActionBarActivity {
final String[] projection = { final String[] projection = {
RepoProvider.DataColumns._ID, RepoProvider.DataColumns._ID,
RepoProvider.DataColumns.NAME, RepoProvider.DataColumns.NAME,
RepoProvider.DataColumns.PUBLIC_KEY, RepoProvider.DataColumns.SIGNING_CERT,
RepoProvider.DataColumns.FINGERPRINT, RepoProvider.DataColumns.FINGERPRINT,
RepoProvider.DataColumns.IN_USE, RepoProvider.DataColumns.IN_USE,
}; };

View File

@ -264,7 +264,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
String repoFingerprint; String repoFingerprint;
// TODO show the current state of the signature check, not just whether there is a key or not // TODO show the current state of the signature check, not just whether there is a key or not
if (TextUtils.isEmpty(repo.fingerprint) && TextUtils.isEmpty(repo.pubkey)) { if (TextUtils.isEmpty(repo.fingerprint) && TextUtils.isEmpty(repo.signingCertificate)) {
repoFingerprint = getResources().getString(R.string.unsigned); repoFingerprint = getResources().getString(R.string.unsigned);
repoFingerprintView.setTextColor(getResources().getColor(R.color.unsigned)); repoFingerprintView.setTextColor(getResources().getColor(R.color.unsigned));
repoFingerprintDescView.setVisibility(View.VISIBLE); repoFingerprintDescView.setVisibility(View.VISIBLE);