use of com.android.apksig.SigningCertificateLineage.SignerConfig in project apksig by venshine.
the class SigningCertificateLineageTest method testFirstRotationContainsExpectedSigners.
@Test
public void testFirstRotationContainsExpectedSigners() throws Exception {
SigningCertificateLineage lineage = createLineageWithSignersFromResources(FIRST_RSA_2048_SIGNER_RESOURCE_NAME, SECOND_RSA_2048_SIGNER_RESOURCE_NAME);
assertLineageContainsExpectedSigners(lineage, mSigners);
SignerConfig unknownSigner = Resources.toLineageSignerConfig(getClass(), THIRD_RSA_2048_SIGNER_RESOURCE_NAME);
assertFalse("The signer " + unknownSigner.getCertificate().getSubjectDN() + " should not be in the lineage", lineage.isSignerInLineage(unknownSigner));
}
use of com.android.apksig.SigningCertificateLineage.SignerConfig in project apksig by venshine.
the class SigningCertificateLineageTest method getSignerConfigFromResources.
private static SignerConfig getSignerConfigFromResources(String resourcePrefix) throws Exception {
PrivateKey privateKey = Resources.toPrivateKey(SigningCertificateLineageTest.class, resourcePrefix + ".pk8");
X509Certificate cert = Resources.toCertificate(SigningCertificateLineageTest.class, resourcePrefix + ".x509.pem");
return new SignerConfig.Builder(privateKey, cert).build();
}
use of com.android.apksig.SigningCertificateLineage.SignerConfig in project apksig by venshine.
the class SigningCertificateLineageTest method testSublineageContainsExpectedSigners.
@Test
public void testSublineageContainsExpectedSigners() throws Exception {
SigningCertificateLineage lineage = createLineageWithSignersFromResources(FIRST_RSA_2048_SIGNER_RESOURCE_NAME, SECOND_RSA_2048_SIGNER_RESOURCE_NAME);
lineage = updateLineageWithSignerFromResources(lineage, THIRD_RSA_2048_SIGNER_RESOURCE_NAME);
List<SignerConfig> subList = mSigners.subList(0, 2);
X509Certificate cert = subList.get(1).getCertificate();
SigningCertificateLineage subLineage = lineage.getSubLineage(cert);
assertLineageContainsExpectedSigners(subLineage, subList);
}
use of com.android.apksig.SigningCertificateLineage.SignerConfig in project apksig by venshine.
the class SigningCertificateLineageTest method testLineageFromFileDoesNotContainUnknownSigner.
@Test
public void testLineageFromFileDoesNotContainUnknownSigner() throws Exception {
// This file contains the lineage with the first two rsa-2048 signers
SigningCertificateLineage lineage = Resources.toSigningCertificateLineage(getClass(), "rsa-2048-lineage-2-signers");
SignerConfig unknownSigner = Resources.toLineageSignerConfig(getClass(), THIRD_RSA_2048_SIGNER_RESOURCE_NAME);
assertFalse("The signer " + unknownSigner.getCertificate().getSubjectDN() + " should not be in the lineage", lineage.isSignerInLineage(unknownSigner));
}
use of com.android.apksig.SigningCertificateLineage.SignerConfig in project apksig by venshine.
the class SigningCertificateLineageTest method testRotationWithExitingLineageAndNonDefaultCapabilitiesForNewSigner.
@Test
public void testRotationWithExitingLineageAndNonDefaultCapabilitiesForNewSigner() throws Exception {
SigningCertificateLineage lineage = createLineageWithSignersFromResources(FIRST_RSA_2048_SIGNER_RESOURCE_NAME, SECOND_RSA_2048_SIGNER_RESOURCE_NAME);
SignerConfig oldSigner = mSigners.get(mSigners.size() - 1);
SignerConfig newSigner = Resources.toLineageSignerConfig(getClass(), THIRD_RSA_2048_SIGNER_RESOURCE_NAME);
List<Boolean> newSignerCapabilityValues = Arrays.asList(false, false, false, false, false);
lineage = lineage.spawnDescendant(oldSigner, newSigner, buildSignerCapabilities(newSignerCapabilityValues));
SignerCapabilities newSignerCapabilities = lineage.getSignerCapabilities(newSigner);
assertExpectedCapabilityValues(newSignerCapabilities, newSignerCapabilityValues);
}
Aggregations