mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 11:38:35 +02:00
Daggerize TMCH/signed mark util classes
This allows them to support injectable configuration. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=143709052
This commit is contained in:
parent
534e3ba01c
commit
c05424b947
19 changed files with 242 additions and 165 deletions
|
@ -26,7 +26,6 @@ import google.registry.flows.EppTestComponent.FakesAndMocksModule;
|
|||
import google.registry.model.registrar.Registrar;
|
||||
import google.registry.model.registry.Registry;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.FakeResponse;
|
||||
import java.util.Map;
|
||||
import org.json.simple.JSONValue;
|
||||
|
@ -63,7 +62,7 @@ public class CheckApiActionTest {
|
|||
action.response = new FakeResponse();
|
||||
action.config = RegistryEnvironment.UNITTEST.config();
|
||||
action.eppController = DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(new FakeClock()))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule())
|
||||
.build()
|
||||
.startRequest()
|
||||
.eppController();
|
||||
|
|
|
@ -71,7 +71,7 @@ public class EppCommitLogsTest extends ShardableTestCase {
|
|||
SessionMetadata sessionMetadata = new HttpSessionMetadata(new FakeHttpSession());
|
||||
sessionMetadata.setClientId("TheRegistrar");
|
||||
DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, true))
|
||||
.build()
|
||||
.startRequest()
|
||||
.flowComponentBuilder()
|
||||
|
|
|
@ -114,7 +114,7 @@ public class EppTestCase extends ShardableTestCase {
|
|||
FakeResponse response = new FakeResponse();
|
||||
handler.response = response;
|
||||
handler.eppController = DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, true))
|
||||
.build()
|
||||
.startRequest()
|
||||
.eppController();
|
||||
|
|
|
@ -31,6 +31,8 @@ import google.registry.monitoring.whitebox.EppMetric;
|
|||
import google.registry.request.RequestScope;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.FakeSleeper;
|
||||
import google.registry.tmch.TmchCertificateAuthority;
|
||||
import google.registry.tmch.TmchXmlSignature;
|
||||
import google.registry.util.Clock;
|
||||
import google.registry.util.Sleeper;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -58,9 +60,15 @@ interface EppTestComponent {
|
|||
final ModulesService modulesService;
|
||||
final Sleeper sleeper;
|
||||
|
||||
FakesAndMocksModule(FakeClock clock) {
|
||||
FakesAndMocksModule() {
|
||||
this(new FakeClock(), true);
|
||||
}
|
||||
|
||||
FakesAndMocksModule(FakeClock clock, boolean tmchCaTestingMode) {
|
||||
this.clock = clock;
|
||||
this.domainFlowTmchUtils = new DomainFlowTmchUtils();
|
||||
this.domainFlowTmchUtils =
|
||||
new DomainFlowTmchUtils(
|
||||
new TmchXmlSignature(new TmchCertificateAuthority(tmchCaTestingMode)));
|
||||
this.sleeper = new FakeSleeper(clock);
|
||||
this.dnsQueue = DnsQueue.create();
|
||||
this.metricBuilder = EppMetric.builderForRequest("request-id-1", clock);
|
||||
|
|
|
@ -277,7 +277,7 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
.isEqualTo(new TypeInstantiator<F>(getClass()){}.getExactType());
|
||||
// Run the flow.
|
||||
return DaggerEppTestComponent.builder()
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock))
|
||||
.fakesAndMocksModule(new FakesAndMocksModule(clock, tmchCaTestingMode))
|
||||
.build()
|
||||
.startRequest()
|
||||
.flowComponentBuilder()
|
||||
|
@ -339,6 +339,12 @@ public abstract class FlowTestCase<F extends Flow> extends ShardableTestCase {
|
|||
return output;
|
||||
}
|
||||
|
||||
private boolean tmchCaTestingMode = true;
|
||||
|
||||
protected void useTmchProdCert() {
|
||||
tmchCaTestingMode = false;
|
||||
}
|
||||
|
||||
public EppOutput dryRunFlowAssertResponse(String xml, String... ignoredPaths) throws Exception {
|
||||
List<Object> beforeEntities = ofy().load().list();
|
||||
EppOutput output =
|
||||
|
|
|
@ -282,7 +282,6 @@ public class DomainApplicationCreateFlowTest
|
|||
setEppInput("domain_create_sunrush_encoded_signed_mark.xml");
|
||||
persistContactsAndHosts();
|
||||
clock.advanceOneMilli();
|
||||
clock.setTo(DateTime.parse("2012-07-26T00:01:00Z"));
|
||||
clock.setTo(DateTime.parse("2012-07-22T00:01:00Z"));
|
||||
thrown.expect(SignedMarkCertificateNotYetValidException.class);
|
||||
runFlow();
|
||||
|
@ -291,7 +290,7 @@ public class DomainApplicationCreateFlowTest
|
|||
@Test
|
||||
@Ignore("I'm not sure how to get this to throw without creating a custom CA / certs")
|
||||
public void testFailure_signedMarkCertificateCorrupt() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
useTmchProdCert();
|
||||
createTld("tld", TldState.SUNRUSH);
|
||||
setEppInput("domain_create_sunrush_encoded_signed_mark_certificate_corrupt.xml");
|
||||
persistContactsAndHosts();
|
||||
|
@ -302,7 +301,7 @@ public class DomainApplicationCreateFlowTest
|
|||
|
||||
@Test
|
||||
public void testFailure_signedMarkCertificateSignature() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
useTmchProdCert();
|
||||
createTld("tld", TldState.SUNRUSH);
|
||||
setEppInput("domain_create_sunrush_encoded_signed_mark.xml");
|
||||
persistContactsAndHosts();
|
||||
|
|
|
@ -851,6 +851,7 @@ class google.registry.model.tmch.TmchCrl {
|
|||
@Id long id;
|
||||
@Parent com.googlecode.objectify.Key<google.registry.model.common.EntityGroupRoot> parent;
|
||||
java.lang.String crl;
|
||||
java.lang.String url;
|
||||
org.joda.time.DateTime updated;
|
||||
}
|
||||
class google.registry.model.transfer.TransferData {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class TmchCrlTest {
|
|||
@SuppressWarnings("null")
|
||||
public void testSuccess() throws Exception {
|
||||
assertThat(TmchCrl.get()).isNull();
|
||||
TmchCrl.set("lolcat");
|
||||
TmchCrl.set("lolcat", "http://lol.cat");
|
||||
assertThat(TmchCrl.get().getCrl()).isEqualTo("lolcat");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import com.google.common.base.Optional;
|
||||
import google.registry.config.RegistryConfig;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.config.TestRegistryConfig;
|
||||
import org.junit.rules.ExternalResource;
|
||||
|
||||
/** JUnit Rule for overriding Nomulus configuration values. */
|
||||
|
@ -42,15 +41,6 @@ public final class RegistryConfigRule extends ExternalResource {
|
|||
RegistryEnvironment.overrideConfigurationForTesting(checkNotNull(override));
|
||||
}
|
||||
|
||||
/** Override registry configuration to use TMCH production CA. */
|
||||
public void useTmchProdCert() {
|
||||
override(new TestRegistryConfig() {
|
||||
@Override
|
||||
public boolean getTmchCaTestingMode() {
|
||||
return false;
|
||||
}});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void before() throws Exception {
|
||||
if (override.isPresent()) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import google.registry.testing.AppEngineRule;
|
|||
import google.registry.testing.ExceptionRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.testing.InjectRule;
|
||||
import google.registry.testing.RegistryConfigRule;
|
||||
import java.security.SignatureException;
|
||||
import java.security.cert.CertificateExpiredException;
|
||||
import java.security.cert.CertificateNotYetValidException;
|
||||
|
@ -53,9 +52,6 @@ public class TmchCertificateAuthorityTest {
|
|||
@Rule
|
||||
public final InjectRule inject = new InjectRule();
|
||||
|
||||
@Rule
|
||||
public final RegistryConfigRule configRule = new RegistryConfigRule();
|
||||
|
||||
private FakeClock clock = new FakeClock(DateTime.parse("2014-01-01T00:00:00Z"));
|
||||
|
||||
@Before
|
||||
|
@ -65,45 +61,49 @@ public class TmchCertificateAuthorityTest {
|
|||
|
||||
@Test
|
||||
public void testFailure_prodRootExpired() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(false);
|
||||
clock.setTo(DateTime.parse("2024-01-01T00:00:00Z"));
|
||||
thrown.expectRootCause(
|
||||
CertificateExpiredException.class, "NotAfter: Sun Jul 23 23:59:59 UTC 2023");
|
||||
TmchCertificateAuthority.getRoot();
|
||||
tmchCertificateAuthority.getRoot();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_prodRootNotYetValid() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(false);
|
||||
clock.setTo(DateTime.parse("2000-01-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class,
|
||||
"NotBefore: Wed Jul 24 00:00:00 UTC 2013");
|
||||
TmchCertificateAuthority.getRoot();
|
||||
tmchCertificateAuthority.getRoot();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_crlDoesntMatchCerts() throws Exception {
|
||||
// Use the prod cl, which won't match our test certificate.
|
||||
TmchCrl.set(readResourceUtf8(TmchCertificateAuthority.class, "icann-tmch.crl"));
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(true);
|
||||
TmchCrl.set(
|
||||
readResourceUtf8(TmchCertificateAuthority.class, "icann-tmch.crl"), "http://cert.crl");
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match");
|
||||
TmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSuccess_verify() throws Exception {
|
||||
TmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(true);
|
||||
tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_verifySignatureDoesntMatch() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(false);
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match");
|
||||
TmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
tmchCertificateAuthority.verify(loadCertificate(GOOD_TEST_CERTIFICATE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFailure_verifyRevoked() throws Exception {
|
||||
TmchCertificateAuthority tmchCertificateAuthority = new TmchCertificateAuthority(true);
|
||||
thrown.expect(CertificateRevokedException.class, "revoked, reason: KEY_COMPROMISE");
|
||||
TmchCertificateAuthority.verify(loadCertificate(REVOKED_TEST_CERTIFICATE));
|
||||
tmchCertificateAuthority.verify(loadCertificate(REVOKED_TEST_CERTIFICATE));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,9 +30,10 @@ import org.junit.Test;
|
|||
/** Unit tests for {@link TmchCrlAction}. */
|
||||
public class TmchCrlActionTest extends TmchActionTestCase {
|
||||
|
||||
private TmchCrlAction newTmchCrlAction() throws MalformedURLException {
|
||||
private TmchCrlAction newTmchCrlAction(boolean tmchCaTestingMode) throws MalformedURLException {
|
||||
TmchCrlAction action = new TmchCrlAction();
|
||||
action.marksdb = marksdb;
|
||||
action.tmchCertificateAuthority = new TmchCertificateAuthority(tmchCaTestingMode);
|
||||
action.tmchCrlUrl = new URL("http://sloth.lol/tmch.crl");
|
||||
return action;
|
||||
}
|
||||
|
@ -40,10 +41,9 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
@Test
|
||||
public void testSuccess() throws Exception {
|
||||
clock.setTo(DateTime.parse("2013-07-24TZ"));
|
||||
configRule.useTmchProdCert();
|
||||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
|
||||
newTmchCrlAction().run();
|
||||
newTmchCrlAction(false).run();
|
||||
verify(httpResponse).getContent();
|
||||
verify(fetchService).fetch(httpRequest.capture());
|
||||
assertThat(httpRequest.getValue().getURL().toString()).isEqualTo("http://sloth.lol/tmch.crl");
|
||||
|
@ -52,11 +52,11 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
@Test
|
||||
public void testFailure_crlTooOld() throws Exception {
|
||||
clock.setTo(DateTime.parse("2020-01-01TZ"));
|
||||
configRule.useTmchProdCert();
|
||||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-test.crl").read());
|
||||
TmchCrlAction action = newTmchCrlAction(false);
|
||||
thrown.expectRootCause(CRLException.class, "New CRL is more out of date than our current CRL.");
|
||||
newTmchCrlAction().run();
|
||||
action.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -65,7 +65,7 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch.crl").read());
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match.");
|
||||
newTmchCrlAction().run();
|
||||
newTmchCrlAction(true).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -74,6 +74,6 @@ public class TmchCrlActionTest extends TmchActionTestCase {
|
|||
when(httpResponse.getContent()).thenReturn(
|
||||
readResourceBytes(TmchCertificateAuthority.class, "icann-tmch-test.crl").read());
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class);
|
||||
newTmchCrlAction().run();
|
||||
newTmchCrlAction(true).run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,17 +57,19 @@ public class TmchXmlSignatureTest {
|
|||
|
||||
private final FakeClock clock = new FakeClock(DateTime.parse("2013-11-24T23:15:37.4Z"));
|
||||
private byte[] smdData;
|
||||
private TmchXmlSignature tmchXmlSignature;
|
||||
|
||||
@Before
|
||||
public void before() throws Exception {
|
||||
inject.setStaticField(TmchCertificateAuthority.class, "clock", clock);
|
||||
tmchXmlSignature = new TmchXmlSignature(new TmchCertificateAuthority(true));
|
||||
}
|
||||
|
||||
public void wrongCertificateAuthority() throws Exception {
|
||||
configRule.useTmchProdCert();
|
||||
tmchXmlSignature = new TmchXmlSignature(new TmchCertificateAuthority(false));
|
||||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
thrown.expectRootCause(SignatureException.class, "Signature does not match");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -75,7 +77,7 @@ public class TmchXmlSignatureTest {
|
|||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
clock.setTo(DateTime.parse("2013-05-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateNotYetValidException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -83,256 +85,256 @@ public class TmchXmlSignatureTest {
|
|||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
clock.setTo(DateTime.parse("2023-06-01T00:00:00Z"));
|
||||
thrown.expectRootCause(CertificateExpiredException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtAgentArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Agent-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtHolderArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Holder-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtHolderChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Holder-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtHolderEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Holder-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtHolderFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Holder-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveCourtHolderRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/Court-Holder-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkAgentArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Agent-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Agent-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Agent-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Agent-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Agent-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkHolderArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Holder-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkHolderChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Holder-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkHolderEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Holder-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkHolderFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Holder-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTrademarkHolderRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/Trademark-Holder-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteAgentArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Agent-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Agent-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Agent-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Agent-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Agent-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteHolderArabicActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Holder-Arabic-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteHolderChineseActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Holder-Chinese-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteHolderEnglishActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Holder-English-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteHolderFrenchActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Holder-French-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActiveTreatystatuteHolderRussianActive() throws Exception {
|
||||
smdData = loadSmd("active/TreatyStatute-Holder-Russian-Active.smd");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidInvalidsignatureCourtAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("invalid/InvalidSignature-Court-Agent-French-Active.smd");
|
||||
thrown.expect(XMLSignatureException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidInvalidsignatureTrademarkAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("invalid/InvalidSignature-Trademark-Agent-English-Active.smd");
|
||||
thrown.expect(XMLSignatureException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidInvalidsignatureTrademarkAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("invalid/InvalidSignature-Trademark-Agent-Russian-Active.smd");
|
||||
thrown.expect(XMLSignatureException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidInvalidsignatureTreatystatuteAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("invalid/InvalidSignature-TreatyStatute-Agent-Chinese-Active.smd");
|
||||
thrown.expect(XMLSignatureException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidInvalidsignatureTreatystatuteAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("invalid/InvalidSignature-TreatyStatute-Agent-English-Active.smd");
|
||||
thrown.expect(XMLSignatureException.class);
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedCourtAgentFrenchActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Court-Agent-French-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTrademarkAgentEnglishActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-English-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTrademarkAgentRussianActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-Trademark-Agent-Russian-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTreatystatuteAgentChineseActive() throws Exception {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-Chinese-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRevokedTmvTmvrevokedTreatystatuteAgentEnglishActive() throws Throwable {
|
||||
smdData = loadSmd("revoked/tmv/TMVRevoked-TreatyStatute-Agent-English-Active.smd");
|
||||
thrown.expectRootCause(CertificateRevokedException.class, "KEY_COMPROMISE");
|
||||
TmchXmlSignature.verify(smdData);
|
||||
tmchXmlSignature.verify(smdData);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ import google.registry.model.domain.DomainApplication;
|
|||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.smd.EncodedSignedMark;
|
||||
import google.registry.model.smd.SignedMarkRevocationList;
|
||||
import google.registry.tmch.TmchCertificateAuthority;
|
||||
import google.registry.tmch.TmchData;
|
||||
import google.registry.tmch.TmchXmlSignature;
|
||||
import org.joda.time.DateTime;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -66,7 +68,8 @@ public class UpdateSmdCommandTest extends CommandTestCase<UpdateSmdCommand> {
|
|||
.setCurrentSponsorClientId("TheRegistrar")
|
||||
.setEncodedSignedMarks(ImmutableList.of(EncodedSignedMark.create("base64", "garbage")))
|
||||
.build());
|
||||
command.tmchUtils = new DomainFlowTmchUtils();
|
||||
command.tmchUtils =
|
||||
new DomainFlowTmchUtils(new TmchXmlSignature(new TmchCertificateAuthority(true)));
|
||||
}
|
||||
|
||||
private DomainApplication reloadDomainApplication() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue