本文整理匯總了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));
}