Search in sources :

Example 1 with OctetSequenceJsonWebKey

use of org.jose4j.jwk.OctetSequenceJsonWebKey in project cas by apereo.

the class EncodingUtils method generateJsonWebKey.

/**
 * Generate octet json web key of given size .
 *
 * @param size the size
 * @return the key
 */
public static String generateJsonWebKey(final int size) {
    final OctetSequenceJsonWebKey octetKey = OctJwkGenerator.generateJwk(size);
    final Map<String, Object> params = octetKey.toParams(JsonWebKey.OutputControlLevel.INCLUDE_SYMMETRIC);
    return params.get(JSON_WEB_KEY).toString();
}
Also used : OctetSequenceJsonWebKey(org.jose4j.jwk.OctetSequenceJsonWebKey)

Example 2 with OctetSequenceJsonWebKey

use of org.jose4j.jwk.OctetSequenceJsonWebKey in project cas by apereo.

the class BaseBinaryCipherExecutor method generateOctetJsonWebKeyOfSize.

@SneakyThrows
private static String generateOctetJsonWebKeyOfSize(final int size) {
    final OctetSequenceJsonWebKey octetKey = OctJwkGenerator.generateJwk(size);
    final Map<String, Object> params = octetKey.toParams(JsonWebKey.OutputControlLevel.INCLUDE_SYMMETRIC);
    return params.get("k").toString();
}
Also used : OctetSequenceJsonWebKey(org.jose4j.jwk.OctetSequenceJsonWebKey) SneakyThrows(lombok.SneakyThrows)

Aggregations

OctetSequenceJsonWebKey (org.jose4j.jwk.OctetSequenceJsonWebKey)2 SneakyThrows (lombok.SneakyThrows)1