Refactored to remove duplicated code and cleaned up warnings for unused imports and deprecated methods.#770
Conversation
…ed imports and deprecated methods. Normalize provider use for EC key pairs. Move common key selector code into an abstract super class. Remove unused imports. Removed used of deprecated constructors and methods. CMS signing improvements and fixed typo. Remove unncessary storePassphraseAction.setEnabled call. Remove duplicate download and view code.
| // counter signer vector if it does not already exist, and then it adds the counter signer. | ||
| signer = SignerInformation.addCounterSigners(signer, counterSigners); | ||
|
|
||
| generator.addCertificates(new JcaCertStore(Arrays.asList(certificateChain))); |
There was a problem hiding this comment.
This added the certs for every countersignature. Now the certs are added to the store one time no matter how many countersigners there are.
| * @throws URISyntaxException If the CRL URL is malformed. | ||
| * @throws CryptoException If the CRL cannot be loaded. | ||
| */ | ||
| public static void downloadCrl(URL url, Window window) throws IOException, URISyntaxException, CryptoException { |
There was a problem hiding this comment.
Made these methods static and public for re-use.
| * enabling/disabling the combo automatically. | ||
| * </p> | ||
| */ | ||
| public abstract class KeySelector implements Serializable { |
There was a problem hiding this comment.
Moved all the common code for the ML-DSA, ML-KEM, and SLH-DSA key selectors into this super class. They're essentially identical.
| // Get a key pair generator | ||
| KeyPairGenerator keyPairGen; | ||
|
|
||
| if (provider == null) { |
There was a problem hiding this comment.
Handle the null provider here to simply the if/else if tree.
|
|
||
| try { | ||
| URL url = new URL(tsaUrl); | ||
| URL url = new URI(tsaUrl).toURL(); |
There was a problem hiding this comment.
Replaced all occurrences of "new URL" with "new URI().toURL()". Added the URISyntaxException to the throws for all relevant methods.
|
All changes look good to me, thanks for the code quality improvements! |
This PR consists of several refactorings: