Examples of RsaVerifier


Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

  public void setKeyPair(KeyPair keyPair) {
    PrivateKey privateKey = keyPair.getPrivate();
    Assert.state(privateKey instanceof RSAPrivateKey, "KeyPair must be an RSA ");
    signer = new RsaSigner((RSAPrivateKey) privateKey);
    RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
    verifier = new RsaVerifier(publicKey);
    verifierKey = "-----BEGIN PUBLIC KEY-----\n" + new String(Base64.encode(publicKey.getEncoded())) + "\n-----END PUBLIC KEY-----";
  }
View Full Code Here

Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

  }

  public void afterPropertiesSet() throws Exception {
    SignatureVerifier verifier = new MacSigner(verifierKey);
    try {
      verifier = new RsaVerifier(verifierKey);
    }
    catch (Exception e) {
      logger.warn("Unable to create an RSA verifier from verifierKey (ignoreable if using MAC)");
    }
    // Check the signing and verification keys match
View Full Code Here

Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

  }

  @Test
  public void rsaSignedTokenParsesAndVerifies() {
    Jwt jwt = JwtHelper.decode(JOE_RSA_TOKEN);
    jwt.verifySignature(new RsaVerifier(N, E));
    assertEquals(JOE_CLAIM_SEGMENT, jwt.getClaims());
  }
View Full Code Here

Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

    assertEquals(JOE_CLAIM_SEGMENT, jwt.getClaims());
  }

  @Test(expected = InvalidSignatureException.class)
  public void invalidRsaSignatureRaisesException() {
    JwtHelper.decodeAndVerify(JOE_RSA_TOKEN, new RsaVerifier(N, D));
  }
View Full Code Here

Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

  }

  @Test
  public void rsaVerificationIsInverseOfSigning() {
    Jwt jwt = JwtHelper.encode(JOE_CLAIM_SEGMENT, new RsaSigner(N, E));
    jwt.verifySignature(new RsaVerifier(N, D));
  }
View Full Code Here

Examples of org.springframework.security.jwt.crypto.sign.RsaVerifier

        + "7HX27b9LR33don/1u/yvzMUo+lrRdKAFJ+9GPE9XFA== \n" + "-----END RSA PRIVATE KEY----- ";
    tokenEnhancer.setSigningKey(rsaKey);
    OAuth2Authentication authentication = new OAuth2Authentication(createOAuth2Request("foo", null),
        userAuthentication);
    OAuth2AccessToken token = tokenEnhancer.enhance(new DefaultOAuth2AccessToken("FOO"), authentication);
    JwtHelper.decodeAndVerify(token.getValue(), new RsaVerifier(rsaKey));
  }
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.