/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package chiffrementrsa;

import chiffrementrsa.utils.MathUtils;
import chiffrementrsa.utils.PrivateKey;
import chiffrementrsa.utils.PublicKey;
import chiffrementrsa.utils.RSAKey;
import java.math.BigInteger;

/**
 *
 * @author Gaëtan
 */
public class ChiffrementRSA {
    
    void createKeys(){
        new PublicKey();
        new PrivateKey();
    }
    
    String encrypt(String messageToEncrypt){
        MathUtils math = new MathUtils();
        String messageEncrypt = new String();
        for(char c : messageToEncrypt.toCharArray()){
            messageEncrypt+= math.mod(math.Power(new BigInteger((int)c+""),7), new BigInteger(5141+"")) + " ";
        }
        return messageEncrypt;

    }
    
    public static void main(String[] args) {
        ChiffrementRSA chiffrement = new ChiffrementRSA();
        chiffrement.createKeys();
        System.out.println(chiffrement.encrypt("Bonjour !"));
        
    }  
}

@@ -910,16 +910,596 @@
 ypt;%0D%0A%0D%0A
+    %7D%0D%0A    %0D%0A    String decrypt(String messageToDecrypt)%7B%0D%0A        MathUtils math = new MathUtils();%0D%0A        String messageDecrypt = new String();%0D%0A        String subMessage = new String():%0D%0A        for(char c : messageToDecrypt.toCharArray())%7B%0D%0A            if(c == %22 %22)%7B%0D%0A                messageDecrypt += math.mod(math.Power(new BigInteger(Integer.parseInt(subMessage.substring(0))),4279), new BigInteger(5141+%22%22));%0D%0A                subMessage = %22%22;%0D%0A            %7D%0D%0A            else%7B%0D%0A                subMessage += c;%0D%0A            %7D%0D%0A        %7D%0D%0A        return messageDecrypt;%0D%0A
     %7D%0D%0A 
@@ -1657,25 +1657,34 @@
    S
-ystem.out.println
+tring message = new String
 (chi
@@ -1712,24 +1712,121 @@
 jour !%22));%0D%0A
+        System.out.println(message);%0D%0A        System.out.println(chiffrement.decrypt(message));%0D%0A
         %0D%0A  

Update ChiffrementRSA.java