001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2016, Connect2id Ltd and contributors. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.jose.crypto.impl; 019 020 021import java.util.Collections; 022import java.util.LinkedHashSet; 023import java.util.Set; 024 025import com.nimbusds.jose.JWSAlgorithm; 026 027 028/** 029 * The base abstract class for RSA signers and verifiers of {@link 030 * com.nimbusds.jose.JWSObject JWS objects}. 031 * 032 * <p>Supports the following algorithms: 033 * 034 * <ul> 035 * <li>{@link com.nimbusds.jose.JWSAlgorithm#RS256} 036 * <li>{@link com.nimbusds.jose.JWSAlgorithm#RS384} 037 * <li>{@link com.nimbusds.jose.JWSAlgorithm#RS512} 038 * <li>{@link com.nimbusds.jose.JWSAlgorithm#PS256} 039 * <li>{@link com.nimbusds.jose.JWSAlgorithm#PS384} 040 * <li>{@link com.nimbusds.jose.JWSAlgorithm#PS512} 041 * </ul> 042 * 043 * @author Vladimir Dzhuvinov 044 * @version 2015-05-31 045 */ 046public abstract class RSASSAProvider extends BaseJWSProvider { 047 048 049 /** 050 * The supported JWS algorithms by the RSA-SSA provider class. 051 */ 052 public static final Set<JWSAlgorithm> SUPPORTED_ALGORITHMS; 053 054 055 static { 056 Set<JWSAlgorithm> algs = new LinkedHashSet<>(); 057 algs.add(JWSAlgorithm.RS256); 058 algs.add(JWSAlgorithm.RS384); 059 algs.add(JWSAlgorithm.RS512); 060 algs.add(JWSAlgorithm.PS256); 061 algs.add(JWSAlgorithm.PS384); 062 algs.add(JWSAlgorithm.PS512); 063 SUPPORTED_ALGORITHMS = Collections.unmodifiableSet(algs); 064 } 065 066 067 /** 068 * Creates a new RSASSA provider. 069 */ 070 protected RSASSAProvider() { 071 072 super(SUPPORTED_ALGORITHMS); 073 } 074} 075