Package com.nimbusds.jose.jwk

Examples of com.nimbusds.jose.jwk.OctetSequenceKey.toByteArray()


    assertEquals(JWEAlgorithm.DIR, jweObject.getHeader().getAlgorithm());
    assertEquals(EncryptionMethod.A128GCM, jweObject.getHeader().getEncryptionMethod());
    assertEquals("77c7e2b8-6e13-45cf-8672-617b5b45243a", jweObject.getHeader().getKeyID());

    JWEDecrypter decrypter = new DirectDecrypter(jwk.toByteArray());

    jweObject.decrypt(decrypter);

    assertEquals(JWEObject.State.DECRYPTED, jweObject.getState());
  }
View Full Code Here


    JWSObject jwsObject = JWSObject.parse(jws);

    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" +
View Full Code Here

    assertEquals(JWEAlgorithm.DIR, jweObject.getHeader().getAlgorithm());
    assertEquals(EncryptionMethod.A128GCM, jweObject.getHeader().getEncryptionMethod());
    assertEquals("77c7e2b8-6e13-45cf-8672-617b5b45243a", jweObject.getHeader().getKeyID());

    JWEDecrypter decrypter = new DirectDecrypter(jwk.toByteArray());

    jweObject.decrypt(decrypter);

    assertEquals(JWEObject.State.DECRYPTED, jweObject.getState());
  }
View Full Code Here

    JWSObject jwsObject = JWSObject.parse(jws);

    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" +
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.