• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Avec112 / commons-security / 18653839291

20 Oct 2025 01:37PM UTC coverage: 86.722%. Remained the same
18653839291

push

github

Avec112
Remove RSA 1024-bit support and set default key size to 3072-bit

- Deprecated and removed `generateKeyPair1024` and `BIT_1024` key size.
- Introduced `generateRsaKeyPair` with a default size of 3072 bits.
- Updated `KeyUtils` and associated unit tests to align with new default key size.
- Amended `README.adoc` to reflect supported RSA key sizes.

27 of 44 branches covered (61.36%)

Branch coverage included in aggregate %.

391 of 438 relevant lines covered (89.27%)

3.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

40.0
src/main/java/io/github/avec112/security/crypto/rsa/KeySize.java
1
package io.github.avec112.security.crypto.rsa;
2

3
import lombok.Getter;
4
import lombok.RequiredArgsConstructor;
5

6
import java.util.stream.Stream;
7

8
/**
9
 * Enum representing predefined key sizes for cryptographic operations.
10
 *
11
 * The {@code KeySize} enum provides a set of constants for commonly used key sizes in bits,
12
 * such as 2048, 3072, and 4096. These constants can be used to define the key size
13
 * in RSA key pair generation or other cryptographic contexts.
14
 */
15
@RequiredArgsConstructor
3✔
16
@Getter
17
public enum KeySize {
18
    BIT_2048(2048),
7✔
19
    BIT_3072(3072),
7✔
20
    BIT_4096(4096);
7✔
21
    private final int keySize;
22

23
    /**
24
     * Retrieves the {@code KeySize} enumeration constant corresponding to the specified key size.
25
     * The method checks the predefined key sizes in the {@link KeySize} enum and returns the matching constant.
26
     * If no match is found, an {@link IllegalArgumentException} is thrown.
27
     *
28
     * @param keySize the key size value represented as an integer (e.g., 2048, 3072, 4096).
29
     * @return the {@link KeySize} constant that matches the specified key size.
30
     * @throws IllegalArgumentException if the specified key size is not supported.
31
     */
32
    public static KeySize getKeySize(int keySize) {
33
        return Stream.of(KeySize.values())
×
34
                .filter(k -> k.keySize == keySize)
×
35
                .findFirst()
×
36
                .orElseThrow(() -> new IllegalArgumentException("keySize " + keySize + " not supported."));
×
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc