Esempio n. 1
0
  /** Test that {@link TlsSni02Challenge} generates a correct authorization key. */
  @Test
  public void testTlsSni02Challenge() throws IOException {
    TlsSni02Challenge challenge = new TlsSni02Challenge(session);
    challenge.unmarshall(TestUtils.getJsonAsMap("tlsSni02Challenge"));

    assertThat(challenge.getType(), is(TlsSni02Challenge.TYPE));
    assertThat(challenge.getStatus(), is(Status.PENDING));
    assertThat(
        challenge.getSubject(),
        is("5bf0b9908ed73bc53ed3327afa52f76b.0a4bea00520f0753f42abe0bb39e3ea8.token.acme.invalid"));
    assertThat(
        challenge.getSanB(),
        is("14e2350a04434f93c2e0b6012968d99d.ed459b6a7a019d9695609b8514f9d63d.ka.acme.invalid"));

    ClaimBuilder cb = new ClaimBuilder();
    challenge.respond(cb);

    assertThat(
        cb.toString(),
        sameJSONAs("{\"keyAuthorization\"=\"" + KEY_AUTHORIZATION + "\"}")
            .allowingExtraUnexpectedFields());
  }
Esempio n. 2
0
 @BeforeClass
 public static void setup() throws IOException {
   session = TestUtils.session();
 }
Esempio n. 3
0
 @Before
 public void setup() throws IOException {
   keyPair = TestUtils.createKeyPair();
 }