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


Java JsonWebEncryption.getPayload方法代码示例

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


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

示例1: decryptJWT

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
/**
 * Decrypt the otp received via mail
 */
@Override
public String decryptJWT(String token) {
  JsonWebEncryption jwe = new JsonWebEncryption();
  Key key = new AesKey(ConfigUtil.get(JWTKEY).getBytes());
  jwe.setKey(key);
  jwe.setAlgorithmHeaderValue(KeyManagementAlgorithmIdentifiers.A128KW);
  jwe.setEncryptionMethodHeaderParameter(
      ContentEncryptionAlgorithmIdentifiers.AES_128_CBC_HMAC_SHA_256);
  try {
    jwe.setCompactSerialization(token);
    return jwe.getPayload();
  } catch (JoseException e) {
    xLogger.warn("Unable to get the jwt service: {0}", e.getMessage());
  }
  jwe.setKey(key);
  return null;
}
 
开发者ID:logistimo,项目名称:logistimo-web-service,代码行数:21,代码来源:AuthenticationServiceImpl.java

示例2: decryptValue

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
/**
 * Decrypt value based on the key created during afterPropertiesSet.
 *
 * @param value the value
 * @return the decrypted value
 */
private String decryptValue(@NotNull final String value) {
    try {
        final JsonWebEncryption jwe = new JsonWebEncryption();
        jwe.setKey(this.secretKeyEncryptionKey);
        jwe.setCompactSerialization(value);
        logger.debug("Decrypting value...");
        return jwe.getPayload();
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:BaseStringCipherExecutor.java

示例3: decryptValue

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
/**
 * Decrypt value based on the key created during init.
 *
 * @param value the value
 * @return the decrypted value
 */
private String decryptValue(@NotNull final String value) {
    try {
        final JsonWebEncryption jwe = new JsonWebEncryption();
        jwe.setKey(this.secretKeyEncryptionKey);
        jwe.setCompactSerialization(value);
        logger.debug("Decrypting value...");
        return jwe.getPayload();
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:DefaultCipherExecutor.java

示例4: decryptValue

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
/**
 * Decrypt value based on the key created during afterPropertiesSet.
 *
 * @param value the value
 * @return the decrypted value
 */
private String decryptValue(final String value) {
    try {
        final JsonWebEncryption jwe = new JsonWebEncryption();
        jwe.setKey(this.secretKeyEncryptionKey);
        jwe.setCompactSerialization(value);
        LOGGER.debug("Decrypting value...");
        return jwe.getPayload();
    } catch (final Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:18,代码来源:BaseStringCipherExecutor.java

示例5: aesEncryptDecrypt128

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
@Test
public void aesEncryptDecrypt128() throws Exception {

    String keyText = "iue98623diDEs096";
    String data = "I am marico";
    Key key = new AesKey(keyText.getBytes());

    //加密
    JsonWebEncryption jwe = new JsonWebEncryption();
    jwe.setAlgorithmHeaderValue(KeyManagementAlgorithmIdentifiers.A128KW);
    jwe.setEncryptionMethodHeaderParameter(ContentEncryptionAlgorithmIdentifiers.AES_128_CBC_HMAC_SHA_256);
    jwe.setKey(key);
    jwe.setPayload(data);

    String idToken = jwe.getCompactSerialization();
    assertNotNull(idToken);
    System.out.println(data + " idToken: " + idToken);

    //解密
    JsonWebEncryption jwe2 = new JsonWebEncryption();
    jwe2.setKey(key);
    jwe2.setCompactSerialization(idToken);

    final String payload = jwe2.getPayload();
    assertNotNull(payload);
    assertEquals(payload, data);

}
 
开发者ID:monkeyk,项目名称:oauth2-shiro,代码行数:29,代码来源:Jose4JTest.java

示例6: aesEncryptDecrypt256

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
@Test
public void aesEncryptDecrypt256() throws Exception {

    String keyText = "[email protected](*JKse09";
    String data = "I am marico";
    Key key = new AesKey(keyText.getBytes());

    //加密
    JsonWebEncryption jwe = new JsonWebEncryption();
    jwe.setAlgorithmHeaderValue(KeyManagementAlgorithmIdentifiers.A256KW);
    jwe.setEncryptionMethodHeaderParameter(ContentEncryptionAlgorithmIdentifiers.AES_256_CBC_HMAC_SHA_512);
    jwe.setKey(key);
    jwe.setPayload(data);

    String idToken = jwe.getCompactSerialization();
    assertNotNull(idToken);
    System.out.println(data + " idToken: " + idToken);

    //解密
    JsonWebEncryption jwe2 = new JsonWebEncryption();
    jwe2.setKey(key);
    jwe2.setCompactSerialization(idToken);

    final String payload = jwe2.getPayload();
    assertNotNull(payload);
    assertEquals(payload, data);

}
 
开发者ID:monkeyk,项目名称:oauth2-shiro,代码行数:29,代码来源:Jose4JTest.java

示例7: decryptValue

import org.jose4j.jwe.JsonWebEncryption; //导入方法依赖的package包/类
/**
 * Decrypt value based on the key created during init.
 *
 * @param value the value
 * @return the decrypted value
 */
private String decryptValue(@NotNull final String value) {
    try {
        final JsonWebEncryption jwe = new JsonWebEncryption();
        jwe.setKey(this.secretKeyEncryptionKey);
        jwe.setCompactSerialization(value);
        LOGGER.debug("Decrypting value...");
        return jwe.getPayload();
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:18,代码来源:DefaultCipherExecutor.java


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