本文整理汇总了Java中org.springframework.security.jwt.crypto.sign.RsaSigner类的典型用法代码示例。如果您正苦于以下问题:Java RsaSigner类的具体用法?Java RsaSigner怎么用?Java RsaSigner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RsaSigner类属于org.springframework.security.jwt.crypto.sign包,在下文中一共展示了RsaSigner类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterPropertiesSet
import org.springframework.security.jwt.crypto.sign.RsaSigner; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
this.setKeyPair(keyPair);
PrivateKey privateKey = keyPair.getPrivate();
signer = new RsaSigner((RSAPrivateKey) privateKey);
this.setAccessTokenConverter(new DefaultIntrospectionAccessTokenConverter());
}
示例2: setVerifierKey
import org.springframework.security.jwt.crypto.sign.RsaSigner; //导入依赖的package包/类
/**
* The key used for verifying signatures produced by this class. This is not used but is returned from the endpoint
* to allow resource servers to obtain the key.
*
* For an HMAC key it will be the same value as the signing key and does not need to be set. For and RSA key, it
* should be set to the String representation of the public key, in a standard format (e.g. OpenSSH keys)
*
* @param key the signature verification key (typically an RSA public key)
*/
public void setVerifierKey(String key) {
this.verifierKey = key;
try {
new RsaSigner(verifierKey);
throw new IllegalArgumentException("Private key cannot be set as verifierKey property");
}
catch (Exception expected) {
// Expected
}
}
示例3: afterPropertiesSet
import org.springframework.security.jwt.crypto.sign.RsaSigner; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
keyPair = new KeyStoreKeyFactory(new InputStreamResource(new FileInputStream(new File(configuration.getJks()))),
configuration.getStorepass().toCharArray()).getKeyPair(configuration.getAlias(), configuration.getKeypass().toCharArray());
signer = new RsaSigner((RSAPrivateKey) keyPair.getPrivate());
}
示例4: rsaVerificationIsInverseOfSigning
import org.springframework.security.jwt.crypto.sign.RsaSigner; //导入依赖的package包/类
@Test
public void rsaVerificationIsInverseOfSigning() {
Jwt jwt = JwtHelper.encode(JOE_CLAIM_SEGMENT, new RsaSigner(N, E));
jwt.verifySignature(new RsaVerifier(N, D));
}