Package com.nimbusds.jose.util

Examples of com.nimbusds.jose.util.Base64


    h.setJWK(jwk);
    h.setX509CertURL(new URL("https://example/cert.b64"));
    h.setX509CertThumbprint(new Base64URL("789iop"));

    List<Base64> certChain = new LinkedList<Base64>();
    certChain.add(new Base64("asd"));
    certChain.add(new Base64("fgh"));
    certChain.add(new Base64("jkl"));

    h.setX509CertChain(certChain);

    h.setAgreementPartyUInfo(new Base64URL("abc"));
    h.setAgreementPartyVInfo(new Base64URL("xyz"));

    h.setPBES2Salt(new Base64URL("omg"));
    h.setPBES2Count(1000);


    String s = h.toString();

    // Parse back
    h = JWEHeader.parse(s);

    assertEquals(JWEAlgorithm.RSA1_5, h.getAlgorithm());
    assertEquals(new JOSEObjectType("JWT"), h.getType());
    assertEquals(EncryptionMethod.A256GCM, h.getEncryptionMethod());
    assertEquals(CompressionAlgorithm.DEF, h.getCompressionAlgorithm());
    assertEquals(new URL("https://example.com/jku.json"), h.getJWKURL());
    assertEquals("1234", h.getKeyID());

    jwk = (RSAKey)h.getJWK();
    assertNotNull(jwk);
    assertEquals(new Base64URL("abc123"), jwk.getModulus());
    assertEquals(new Base64URL("def456"), jwk.getPublicExponent());
    assertEquals(KeyUse.ENCRYPTION, jwk.getKeyUse());
    assertEquals(JWEAlgorithm.RSA1_5, jwk.getAlgorithm());
    assertEquals("1234", jwk.getKeyID());

    assertEquals(new URL("https://example/cert.b64"), h.getX509CertURL());
    assertEquals(new Base64URL("789iop"), h.getX509CertThumbprint());

    certChain = h.getX509CertChain();
    assertEquals(3, certChain.size());
    assertEquals(new Base64("asd"), certChain.get(0));
    assertEquals(new Base64("fgh"), certChain.get(1));
    assertEquals(new Base64("jkl"), certChain.get(2));

    assertEquals(new Base64URL("abc"), h.getAgreementPartyUInfo());
    assertEquals(new Base64URL("xyz"), h.getAgreementPartyVInfo());

    assertEquals(new Base64URL("omg"), h.getPBES2Salt());
View Full Code Here


    throws Exception {

    URL x5u = new URL("http://example.com/jwk.json");
    Base64URL x5t = new Base64URL("abc");
    List<Base64> x5c = new LinkedList<Base64>();
    x5c.add(new Base64("def"));

    Set<KeyOperation> ops = null;

    ECKey key = new ECKey(ExampleKeyP256.CRV, ExampleKeyP256.X, ExampleKeyP256.Y, ExampleKeyP256.D,
                    KeyUse.SIGNATURE, ops, JWSAlgorithm.ES256, "1", x5u, x5t, x5c);
View Full Code Here

    throws Exception {

    URL x5u = new URL("http://example.com/jwk.json");
    Base64URL x5t = new Base64URL("abc");
    List<Base64> x5c = new LinkedList<Base64>();
    x5c.add(new Base64("def"));

    KeyUse use = null;
    Set<KeyOperation> ops = new LinkedHashSet<KeyOperation>(Arrays.asList(KeyOperation.SIGN, KeyOperation.VERIFY));

    ECKey key = new ECKey(ExampleKeyP256.CRV, ExampleKeyP256.X, ExampleKeyP256.Y, ExampleKeyP256.D,
View Full Code Here

    throws Exception {

    URL x5u = new URL("http://example.com/jwk.json");
    Base64URL x5t = new Base64URL("abc");
    List<Base64> x5c = new LinkedList<Base64>();
    x5c.add(new Base64("def"));

    ECKey key = new ECKey.Builder(ECKey.Curve.P_256, ExampleKeyP256.X, ExampleKeyP256.Y).
      d(ExampleKeyP256.D).
      keyUse(KeyUse.SIGNATURE).
      algorithm(JWSAlgorithm.ES256).
View Full Code Here

TOP

Related Classes of com.nimbusds.jose.util.Base64

Copyright © 2018 www.massapicom. 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.