Class RSAAlgorithm
java.lang.Object
org.episteme.core.mathematics.cryptography.RSAAlgorithm
The RSA (Rivest–Shamir–Adleman) encryption algorithm.
RSA is a public-key cryptosystem that is widely used for secure data transmission. It is based on the practical difficulty of the factorization of the product of two large prime numbers, the "factoring problem".
References
- Wikipedia: RSA (cryptosystem)
- Rivest, R. L., Shamir, A., invalid input: '&' Adleman, L. (1978). "A Method for Obtaining Digital Signatures and Public-Key Cryptosystems". Communications of the ACM, 21(2), 120–126.
- Menezes, A. J., van Oorschot, P. C., invalid input: '&' Vanstone, S. A. (1996). Handbook of Applied Cryptography. CRC Press.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BigIntegerdecrypt(BigInteger ciphertext, RSAAlgorithm.PrivateKey privateKey) Decrypts ciphertext using private key: m = c^d mod nstatic BigIntegerencrypt(BigInteger message, RSAAlgorithm.PublicKey publicKey) Encrypts message using public key: c = m^e mod nstatic RSAAlgorithm.KeyPairgenerateKeyPair(int bitLength) Generates RSA key pair.static BigIntegersign(BigInteger message, RSAAlgorithm.PrivateKey privateKey) Signs message using private key.static booleanverify(BigInteger message, BigInteger signature, RSAAlgorithm.PublicKey publicKey) Verifies signature using public key.
-
Constructor Details
-
RSAAlgorithm
public RSAAlgorithm()
-
-
Method Details
-
generateKeyPair
Generates RSA key pair.- Parameters:
bitLength- key size in bits (e.g., 2048, 4096)- Returns:
- public and private keys
-
encrypt
Encrypts message using public key: c = m^e mod n -
decrypt
Decrypts ciphertext using private key: m = c^d mod n -
sign
Signs message using private key. -
verify
public static boolean verify(BigInteger message, BigInteger signature, RSAAlgorithm.PublicKey publicKey) Verifies signature using public key.
-