feat: load RSA public key via modulus and exponent

This commit is contained in:
siujamo
2025-06-09 11:49:57 +08:00
parent 6ac9f1ae49
commit e03cc180c9
2 changed files with 31 additions and 0 deletions
@@ -17,8 +17,11 @@
package com.onixbyte.security;
import com.onixbyte.security.exception.KeyLoadingException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.interfaces.RSAPublicKey;
/**
* The {@code KeyLoader} class provides utility methods for loading keys pairs from PEM-formatted
@@ -49,6 +52,10 @@ public interface KeyLoader {
*/
PublicKey loadPublicKey(String pemKeyText);
default RSAPublicKey loadPublicKey(String modulus, String exponent) {
throw new KeyLoadingException("This key loader does not support RSA Public key loading.");
}
/**
* Retrieves the raw content of a PEM formatted key by removing unnecessary headers, footers,
* and new line characters.