File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
key-pair-loader/src/main/java/com/onixbyte/security Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1919
2020import com .onixbyte .security .exception .KeyLoadingException ;
2121
22+ import java .security .KeyFactory ;
2223import java .security .PrivateKey ;
2324import java .security .PublicKey ;
2425import java .security .interfaces .RSAPublicKey ;
26+ import java .security .spec .KeySpec ;
2527
2628/**
2729 * The {@code KeyLoader} class provides utility methods for loading keys pairs from PEM-formatted
@@ -52,6 +54,15 @@ public interface KeyLoader {
5254 */
5355 PublicKey loadPublicKey (String pemKeyText );
5456
57+ /**
58+ * Get the public key with given modulus and public exponent.
59+ *
60+ * @param modulus the modulus
61+ * @param exponent the public exponent
62+ * @return generated public key object from the provided key specification
63+ * @see KeyFactory#getInstance(String)
64+ * @see KeyFactory#generatePublic(KeySpec)
65+ */
5566 default RSAPublicKey loadPublicKey (String modulus , String exponent ) {
5667 throw new KeyLoadingException ("This key loader does not support RSA Public key loading." );
5768 }
Original file line number Diff line number Diff line change 2525import java .security .NoSuchAlgorithmException ;
2626import java .security .interfaces .RSAPrivateKey ;
2727import java .security .interfaces .RSAPublicKey ;
28- import java .security .spec .InvalidKeySpecException ;
29- import java .security .spec .PKCS8EncodedKeySpec ;
30- import java .security .spec .RSAPublicKeySpec ;
31- import java .security .spec .X509EncodedKeySpec ;
28+ import java .security .spec .*;
3229import java .util .Base64 ;
3330
3431/**
@@ -140,6 +137,15 @@ public RSAPublicKey loadPublicKey(String pemKeyText) {
140137 }
141138 }
142139
140+ /**
141+ * Get the public key with given modulus and public exponent.
142+ *
143+ * @param modulus the modulus
144+ * @param exponent the public exponent
145+ * @return generated public key object from the provided key specification
146+ * @see KeyFactory#getInstance(String)
147+ * @see KeyFactory#generatePublic(KeySpec)
148+ */
143149 @ Override
144150 public RSAPublicKey loadPublicKey (String modulus , String exponent ) {
145151 try {
You can’t perform that action at this time.
0 commit comments