Bonjour
voila je m y connais pas du tout en java c est pour cela que je reclame votre aide
afin de finalise mon projet scolaire .
se que je voudrai c est de modifier se petit programme en java afin qu il genere une cle n qui soit egale a la cle N predefinit par moi meme exemple :
je choisit N=425704030494521 et 50 pour la taille en bits.
je voudrai que le programme trouve les cle e et d t elle que n=N
voici le site http://www.bibmath.net/crypto/moderne/rsa.php3
et la source merci d avance
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.math.BigInteger;
import java.util.Random;
public class makecle extends Applet
implements ActionListener
{
public void init()
{
setBackground(Color.white);
texte = new Label("Taille de la cl\351 (en bits) :");
area = new TextField(4);
area.setText("50");
aff = new TextArea(8, 60);
bouton = new Button("Fabriquer!");
bouton.setBackground(Color.orange);
bouton.addActionListener(this);
aff.setEditable(false);
aff.setForeground(Color.red);
add(texte);
add(area);
add(bouton);
add(aff);
}
public void actionPerformed(ActionEvent actionevent)
{
AlertPanel alertpanel;
try
{
Integer integer = new Integer(area.getText());
Random random = new Random();
BigInteger biginteger1 = new BigInteger(integer.intValue() / 2, 100, random);
BigInteger biginteger2 = new BigInteger(integer.intValue() / 2, 100, random);
BigInteger biginteger4 = biginteger1.multiply(biginteger2);
biginteger1 = biginteger1.subtract(new BigInteger("1"));
biginteger2 = biginteger2.subtract(new BigInteger("1"));
BigInteger biginteger = biginteger1.multiply(biginteger2);
BigInteger biginteger5 = new BigInteger("3");
for(BigInteger biginteger6 = biginteger5.gcd(biginteger); biginteger6.compareTo(new BigInteger("1")) != 0; biginteger6 = biginteger5.gcd(biginteger))
biginteger5 = biginteger5.add(new BigInteger("1"));
BigInteger biginteger9 = biginteger;
BigInteger biginteger14 = biginteger9;
BigInteger biginteger8 = biginteger5;
BigInteger biginteger10 = new BigInteger("1");
BigInteger biginteger13 = new BigInteger("0");
BigInteger biginteger11 = new BigInteger("0");
BigInteger biginteger7;
for(BigInteger biginteger12 = new BigInteger("1"); biginteger8.compareTo(new BigInteger("0")) != 0; biginteger12 = biginteger7.subtract(biginteger12))
{
BigInteger biginteger3 = biginteger9.divide(biginteger8);
biginteger7 = biginteger9;
biginteger9 = biginteger8;
biginteger8 = biginteger8.multiply(biginteger3);
biginteger8 = biginteger7.subtract(biginteger8);
biginteger7 = biginteger10;
biginteger10 = biginteger13;
biginteger13 = biginteger13.multiply(biginteger3);
biginteger13 = biginteger7.subtract(biginteger13);
biginteger7 = biginteger11;
biginteger11 = biginteger12;
biginteger12 = biginteger12.multiply(biginteger3);
}
String s = new String("Cl\351 publique :\nn=" + biginteger4.toString() + "\n" + "e=" + biginteger5.toString() + "\nCl\351 priv\351e :\nn=" + biginteger4.toString() + "\n" + "d=" + biginteger11.toString());
aff.setText(s);
return;
}
catch(NumberFormatException _ex)
{
alertpanel = new AlertPanel("Format du nombre incorrect!");
}
}
public String getAppletInfo()
{
return "Fabrication de cl\351s RSA - Fr\351d\351ric Bayart";
}
public String[][] getParameterInfo()
{
return null;
}
public makecle()
{
isStandalone = false;
}
boolean isStandalone;
Label texte;
TextField area;
TextArea aff;
Button bouton;
}