Correction of the Loping Koshelki in Autonomic Regima with Piton, Java or C ++
In this state, we dissatisfied with the help of the help of the generation of the enclosures (100,000 pairs of Klavish) in the autonomous regime in Python, Java and C ++. We also have a dispensary use of the commander stroke.
Method 1: Using OpenSSL
OpenSSL Popular Library with an open source code used for cryptographic operating. We can use it for the generation of Carvysh in the autonomic regime.
Python
code
`Python
Import Subprostess
Def Generate_Walletofline ():
Specify the OpenSSL configuration file (for example,Openssl.conf)
Config_file = "Openssl.conf"
Specify Format Koshka (for example, Pem, der)
Wallet_format = "Der"
Spoiled pairs key in autonomic regimen with 100 000 koshalk
For I d Diopazon (100,000):
Command = f "Openssl Gensa -out {config_file} _i {i} _ {Wallet_format} .der"
Subprocess.run (Command, Shell = True)
#Building of the liner key from the consumed koshalki
Wallet_dir = "Zhoelki _ {} _ {Wallet_format}". Format (I + 1)
For the name of the file in OS.LISTDIR (Wallet_DIR):
If Filename.endswith ("Der"):
with Open (OS.Path.join (Wallet_dir, File), "RB") How F: F:
KEY = F.RAD ()
Private_key = key
#Reranted closed key for file (for example,Private_key _ {} {Wallet_format} .Pempyw
SAVE_PRIVATE_KEY (Private_Key)
If __name__ == “__main__”:
Generate_walletoffline ()
`
Java code
`Java
Import Java.io.bufferedreader;
Java.io.file Import;
Java.io.filewriter Import;
Importing Java.io.ioexception;
Opened Class Generatewalletoffline {
Public Static Void Main (String [] Args) {
// Specify the Openssl configuration file (for example,Openssl.conf)
String configfile = "openssl.conf";
// Specify Format Koshka (for example, der)
String Walletformat = "der";
// Generate Paris Key in autonomic regimen with 100 000 kosolk
for (int I = 0; I <100000; I ++) {
System.out.println ("FEEDING CLOSED" + (I + 1) + ...);
// Linn the Commond Openssl, to sprout the koshalek
String Command = "Openssl Gensa -out" + Configfile + "_I" + (I + 1) + "_" + Walletformat + ".Der";
Process Process = runtime.getruntime (). Exec (Command);
Bufferedreader Reader = New BufferedRader (New Inputstreamreader (Process.getinPutstream));
Stress inputline;
While ((inputline = Reader.Readline ())! = Null) {
// Bend the closed key out of output
System.out.println ("closed key" + (I + 1) + ... = " + inputline);
}
}
// Coam sgenerged partly keys to files (for example,private_Key_100000_I0.Derand
Private_Key_100000.pwpk)
for (int I = 0; I <100000; I ++) {
System.out.println ("Claimed key" + (I + 1) + ... for file ");
// Linn the Commond Openssl, To Swit Closed Key
String filename = configfile + "_" + (I + 1) + "_" + Walletformat + ".pwpk";
TRY (Filewriter Writer = New Filewriter (Filename)) {
writer.write ("Private_key_" + (I + 1) + ...);
}
}
}
}
C ++ Code
“ CPP
#include
#include
#include
#include
// Function for creation closed key
STD :: String GeneratePrivatekey (Size_t N, Size_T P) {
Unsigned Char* Key = New unsigned Char [N + 1];
Rand_bytes (Key, N);
STD :: Stringstream SS;
for (Size_t I = 0; I
SS << Static_cast
}
// Said the closed key in file
STD :: ofstream File (“Private_key_” + STD :: to_string (N) + “_” + std :: to_string (p) + “.pwpk”);
IF (file.