示例#1
0
  @Test
  public void testSignWithProtectedHeaderOnlyFlat() {
    JwsJsonProducer producer = new JwsJsonProducer(UNSIGNED_PLAIN_JSON_DOCUMENT, true);
    JwsHeaders headerEntries = new JwsHeaders();
    headerEntries.setSignatureAlgorithm(SignatureAlgorithm.HS256);

    producer.signWith(
        new HmacJwsSignatureProvider(ENCODED_MAC_KEY_1, SignatureAlgorithm.HS256), headerEntries);
    assertEquals(SIGNED_JWS_JSON_FLAT_DOCUMENT, producer.getJwsJsonSignedDocument());
  }
示例#2
0
  @Test
  public void testSignPlainJsonDocumentPayloadConstruction() {
    JwsJsonProducer producer = new JwsJsonProducer(UNSIGNED_PLAIN_JSON_DOCUMENT);

    assertEquals(UNSIGNED_PLAIN_JSON_DOCUMENT_AS_B64URL, producer.getUnsignedEncodedPayload());
  }