Package com.nimbusds.jose

Examples of com.nimbusds.jose.JWSObject.verify()



    MACVerifier verifier = new MACVerifier(sharedSecret);
    assertEquals("Shared secret check", sharedSecret, verifier.getSharedSecret());

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Verified signature", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here


    // To parse the JWS and verify it, e.g. on client-side
    jwsObject = JWSObject.parse(s);

    JWSVerifier verifier = new MACVerifier(sharedSecret);

    assertTrue(jwsObject.verify(verifier));

    assertEquals("Hello, world!", jwsObject.getPayload().toString());
  }

View Full Code Here


    MACVerifier verifier = new MACVerifier(stringSecret);
    assertEquals("Shared secret string check", stringSecret, verifier.getSharedSecretString());

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Verified signature", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());

    JWSVerifier verifier = new MACVerifier(sharedSecret);

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Signature check", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here

    assertEquals(JWSAlgorithm.HS256, jwsObject.getHeader().getAlgorithm());
    assertEquals("018c0ae5-4d9b-471b-bfd6-eef314bc7037", jwsObject.getHeader().getKeyID());

    JWSVerifier verifier = new MACVerifier(jwk.toByteArray());

    assertTrue(jwsObject.verify(verifier));

    assertEquals("SXTigJlzIGEgZGFuZ2Vyb3VzIGJ1c2luZXNzLCBGcm9kbywgZ29pbmcgb3V0IH" +
      "lvdXIgZG9vci4gWW91IHN0ZXAgb250byB0aGUgcm9hZCwgYW5kIGlmIHlvdSBk" +
      "b24ndCBrZWVwIHlvdXIgZmVldCwgdGhlcmXigJlzIG5vIGtub3dpbmcgd2hlcm" +
      "UgeW91IG1pZ2h0IGJlIHN3ZXB0IG9mZiB0by4", jwsObject.getPayload().toBase64URL().toString());
View Full Code Here

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());

    MACVerifier verifier = new MACVerifier(stringSecret);
    verifier.getIgnoredCriticalHeaderParameters().add("exp");

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Verified signature", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());

    MACVerifier verifier = new MACVerifier(stringSecret);

    boolean verified = jwsObject.verify(verifier);

    assertFalse("Verified signature", verified);

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());
  }
View Full Code Here


    RSASSAVerifier verifier = new RSASSAVerifier(PUBLIC_KEY);
    assertNotNull("Public key check", verifier.getPublicKey());

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Verified signature", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());

    JWSVerifier verifier = new RSASSAVerifier(PUBLIC_KEY);

    boolean verified = jwsObject.verify(verifier);

    assertTrue("Signature check", verified);

    assertEquals("State check", JWSObject.State.VERIFIED, jwsObject.getState());
  }
View Full Code Here

    assertEquals("State check", JWSObject.State.SIGNED, jwsObject.getState());

    JWSVerifier verifier = new RSASSAVerifier(PUBLIC_KEY);

    boolean verified = jwsObject.verify(verifier);

    assertFalse("Signature check", verified);
  }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.