1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-10 06:11:08 +01:00

Remove RSA_SIGN and RSA_ENCRYPT as they are deprecated

This change removes two mechanisms that are deprecated in RFC 4880. The
spec explicitly mentions that "RSA Encrypt-Only (2) and RSA Sign-Only
are deprecated and SHOULD NOT be generated" [0].

The remaining RSA_GENERAL key type was renamed to just RSA for ease of
use for developers.

[0]: https://tools.ietf.org/html/rfc4880#section-9.1
This commit is contained in:
Wiktor Kwapisiewicz 2020-10-30 11:43:21 +01:00
parent 63d6ab743c
commit e30d0f6293
No known key found for this signature in database
GPG key ID: B97A1EE09DB417EC
8 changed files with 17 additions and 80 deletions

View file

@ -57,7 +57,7 @@ import org.pgpainless.key.collection.PGPKeyRing;
import org.pgpainless.key.generation.type.ECDH;
import org.pgpainless.key.generation.type.ECDSA;
import org.pgpainless.key.generation.type.KeyType;
import org.pgpainless.key.generation.type.RSA_GENERAL;
import org.pgpainless.key.generation.type.RSA;
import org.pgpainless.key.generation.type.curve.EllipticCurve;
import org.pgpainless.key.generation.type.length.RsaLength;
import org.pgpainless.provider.ProviderFactory;
@ -108,7 +108,7 @@ public class KeyRingBuilder implements KeyRingBuilderInterface {
throws PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
WithAdditionalUserIdOrPassphrase builder = this
.withMasterKey(
KeySpec.getBuilder(RSA_GENERAL.withLength(length))
KeySpec.getBuilder(RSA.withLength(length))
.withDefaultKeyFlags()
.withDefaultAlgorithms())
.withPrimaryUserId(userId);

View file

@ -22,16 +22,19 @@ import java.security.spec.RSAKeyGenParameterSpec;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.key.generation.type.length.RsaLength;
public class RSA_GENERAL implements KeyType {
/**
* Key type that specifies the RSA_GENERAL algorithm.
*/
public class RSA implements KeyType {
private final RsaLength length;
RSA_GENERAL(@Nonnull RsaLength length) {
RSA(@Nonnull RsaLength length) {
this.length = length;
}
public static RSA_GENERAL withLength(@Nonnull RsaLength length) {
return new RSA_GENERAL(length);
public static RSA withLength(@Nonnull RsaLength length) {
return new RSA(length);
}
@Override

View file

@ -1,33 +0,0 @@
/*
* Copyright 2018 Paul Schaub.
*
* 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 org.pgpainless.key.generation.type;
import javax.annotation.Nonnull;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.key.generation.type.length.RsaLength;
public class RSA_ENCRYPT extends RSA_GENERAL {
RSA_ENCRYPT(@Nonnull RsaLength length) {
super(length);
}
@Override
public PublicKeyAlgorithm getAlgorithm() {
return PublicKeyAlgorithm.RSA_ENCRYPT;
}
}

View file

@ -1,33 +0,0 @@
/*
* Copyright 2018 Paul Schaub.
*
* 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 org.pgpainless.key.generation.type;
import javax.annotation.Nonnull;
import org.pgpainless.algorithm.PublicKeyAlgorithm;
import org.pgpainless.key.generation.type.length.RsaLength;
public class RSA_SIGN extends RSA_GENERAL {
RSA_SIGN(@Nonnull RsaLength length) {
super(length);
}
@Override
public PublicKeyAlgorithm getAlgorithm() {
return PublicKeyAlgorithm.RSA_SIGN;
}
}