当前位置: 首页>>代码示例>>Java>>正文


Java AlgorithmIdentifiers.RSA_USING_SHA256属性代码示例

本文整理汇总了Java中org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA256属性的典型用法代码示例。如果您正苦于以下问题:Java AlgorithmIdentifiers.RSA_USING_SHA256属性的具体用法?Java AlgorithmIdentifiers.RSA_USING_SHA256怎么用?Java AlgorithmIdentifiers.RSA_USING_SHA256使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.jose4j.jws.AlgorithmIdentifiers的用法示例。


在下文中一共展示了AlgorithmIdentifiers.RSA_USING_SHA256属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

/**
 * Initialize this component by building up the consumer for JWT using the
 * pre-configured secret
 *
 * @param rsaPublicKey the RSA public key to be used for verification.
 *
 * @return Fluent interface.
 */
SSOFacade initialize(final RSAPublicKey rsaPublicKey) {

  if (logger.isDebugEnabled()) {
    logger.debug("Initializing single-sign-on manager SSOFacade. ");
  }

  Objects.requireNonNull(rsaPublicKey);

  // Build up the algorithm constraints by only accepting RSA_USING_SHA256.
  final AlgorithmConstraints algorithmConstraints = new AlgorithmConstraints(
    AlgorithmConstraints.ConstraintType.WHITELIST, AlgorithmIdentifiers.RSA_USING_SHA256);

  this.jwtConsumer = new JwtConsumerBuilder()
    .setJwsAlgorithmConstraints(algorithmConstraints)
    .setSkipDefaultAudienceValidation()
    .setVerificationKey(rsaPublicKey)
    .setRequireExpirationTime()
    .setRequireNotBefore()
    .setRequireIssuedAt() 
    .build();

  return this;
}
 
开发者ID:Staffbase,项目名称:plugins-sdk-java,代码行数:31,代码来源:SSOFacade.java

示例2: generateAccessTokenHash

private String generateAccessTokenHash(final AccessToken accessTokenId,
                                       final OidcRegisteredService service) {
    final byte[] tokenBytes = accessTokenId.getId().getBytes();
    final String hashAlg;

    switch (signingService.getJsonWebKeySigningAlgorithm()) {
        case AlgorithmIdentifiers.RSA_USING_SHA512:
            hashAlg = MessageDigestAlgorithms.SHA_512;
            break;
        case AlgorithmIdentifiers.RSA_USING_SHA256:
        default:
            hashAlg = MessageDigestAlgorithms.SHA_256;
    }

    LOGGER.debug("Digesting access token hash via algorithm [{}]", hashAlg);
    final byte[] digested = DigestUtils.rawDigest(hashAlg, tokenBytes);
    final byte[] hashBytesLeftHalf = Arrays.copyOf(digested, digested.length / 2);
    return EncodingUtils.encodeBase64(hashBytesLeftHalf);
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:19,代码来源:OidcIdTokenGeneratorService.java

示例3: getAlgorithmIdentifier

private String getAlgorithmIdentifier() {
    String algorithmId = AlgorithmIdentifiers.RSA_USING_SHA256;
    switch (this.encryptionAlgorithm) {
        case RSA_SHA_384:
            algorithmId = AlgorithmIdentifiers.RSA_USING_SHA384;
            break;
        case RSA_SHA_512:
            algorithmId = AlgorithmIdentifiers.RSA_USING_SHA512;
            break;
        case RSA_SHA_256:
        default:
            break;
    }

    return algorithmId;
}
 
开发者ID:box,项目名称:box-java-sdk,代码行数:16,代码来源:BoxDeveloperEditionAPIConnection.java

示例4: keyAlgorithm

/**
 * Analyzes the key used in the {@link JsonWebKey}, and returns the key algorithm
 * identifier for {@link JsonWebSignature}.
 *
 * @param jwk
 *            {@link JsonWebKey} to analyze
 * @return algorithm identifier
 * @throws IllegalArgumentException
 *             there is no corresponding algorithm identifier for the key
 */
public static String keyAlgorithm(JsonWebKey jwk) {
    if (jwk instanceof EllipticCurveJsonWebKey) {
        EllipticCurveJsonWebKey ecjwk = (EllipticCurveJsonWebKey) jwk;

        switch (ecjwk.getCurveName()) {
            case "P-256":
                return AlgorithmIdentifiers.ECDSA_USING_P256_CURVE_AND_SHA256;

            case "P-384":
                return AlgorithmIdentifiers.ECDSA_USING_P384_CURVE_AND_SHA384;

            case "P-521":
                return AlgorithmIdentifiers.ECDSA_USING_P521_CURVE_AND_SHA512;

            default:
                throw new IllegalArgumentException("Unknown EC name "
                    + ecjwk.getCurveName());
        }

    } else if (jwk instanceof RsaJsonWebKey) {
        return AlgorithmIdentifiers.RSA_USING_SHA256;

    } else {
        throw new IllegalArgumentException("Unknown algorithm " + jwk.getAlgorithm());
    }
}
 
开发者ID:shred,项目名称:acme4j,代码行数:36,代码来源:AcmeUtils.java

示例5: getJsonWebKeySigningAlgorithm

public String getJsonWebKeySigningAlgorithm() {
    return AlgorithmIdentifiers.RSA_USING_SHA256;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:3,代码来源:OidcIdTokenSigningAndEncryptionService.java

示例6: JwtTokenIssuer

JwtTokenIssuer(String issuer, PrivateKey privateKey, Certificate cert)
{
    this(issuer, 0, AlgorithmIdentifiers.RSA_USING_SHA256, privateKey, cert, null);
}
 
开发者ID:curityio,项目名称:oauth-filter-for-java,代码行数:4,代码来源:JwtTokenIssuer.java


注:本文中的org.jose4j.jws.AlgorithmIdentifiers.RSA_USING_SHA256属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。