com.nimbusds.jose.crypto.impl.RSACryptoProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nimbus-jose-jwt Show documentation
Show all versions of nimbus-jose-jwt Show documentation
Java library for Javascript Object Signing and Encryption (JOSE) and
JSON Web Tokens (JWT)
/*
* nimbus-jose-jwt
*
* Copyright 2012-2016, Connect2id Ltd and contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.nimbusds.jose.crypto.impl;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.crypto.SecretKey;
import com.nimbusds.jose.EncryptionMethod;
import com.nimbusds.jose.JWEAlgorithm;
/**
* The base abstract class for RSA encrypters and decrypters of
* {@link com.nimbusds.jose.JWEObject JWE objects}.
*
* Supports the following key management algorithms:
*
*
* - {@link com.nimbusds.jose.JWEAlgorithm#RSA1_5}
*
- {@link com.nimbusds.jose.JWEAlgorithm#RSA_OAEP}
*
- {@link com.nimbusds.jose.JWEAlgorithm#RSA_OAEP_256}
*
*
* Supports the following content encryption algorithms:
*
*
* - {@link com.nimbusds.jose.EncryptionMethod#A128CBC_HS256}
*
- {@link com.nimbusds.jose.EncryptionMethod#A192CBC_HS384}
*
- {@link com.nimbusds.jose.EncryptionMethod#A256CBC_HS512}
*
- {@link com.nimbusds.jose.EncryptionMethod#A128GCM}
*
- {@link com.nimbusds.jose.EncryptionMethod#A192GCM}
*
- {@link com.nimbusds.jose.EncryptionMethod#A256GCM}
*
- {@link com.nimbusds.jose.EncryptionMethod#A128CBC_HS256_DEPRECATED}
*
- {@link com.nimbusds.jose.EncryptionMethod#A256CBC_HS512_DEPRECATED}
*
- {@link com.nimbusds.jose.EncryptionMethod#XC20P}
*
*
* @author David Ortiz
* @author Vladimir Dzhuvinov
* @author Egor Puzanov
* @version 2023-03-26
*/
public abstract class RSACryptoProvider extends BaseJWEProvider {
/**
* The supported JWE algorithms by the RSA crypto provider class.
*/
public static final Set SUPPORTED_ALGORITHMS;
/**
* The supported encryption methods by the RSA crypto provider class.
*/
public static final Set SUPPORTED_ENCRYPTION_METHODS = ContentCryptoProvider.SUPPORTED_ENCRYPTION_METHODS;
static {
Set algs = new LinkedHashSet<>();
algs.add(JWEAlgorithm.RSA1_5);
algs.add(JWEAlgorithm.RSA_OAEP);
algs.add(JWEAlgorithm.RSA_OAEP_256);
algs.add(JWEAlgorithm.RSA_OAEP_384);
algs.add(JWEAlgorithm.RSA_OAEP_512);
SUPPORTED_ALGORITHMS = Collections.unmodifiableSet(algs);
}
/**
* Creates a new RSA encryption / decryption provider.
*
* @param cek The Content Encryption Key (CEK). Must be 128 bits (16
* bytes), 192 bits (24 bytes), 256 bits (32 bytes), 384
* bits (48 bytes) or 512 bits (64 bytes) long. Must not be
* {@code null}.
*/
protected RSACryptoProvider(final SecretKey cek) {
super(SUPPORTED_ALGORITHMS, ContentCryptoProvider.SUPPORTED_ENCRYPTION_METHODS, cek);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy