Python uses M2crypto to read and write files, always quote:
Openssl_uplink (58d46000,08): No Openssl_applink
Functions related to file IO cannot be directly manipulated when using OpenSSL under the Windows platform. Because MS/UPLINK.C will get the MS/APPLINK.C function table dynamically from the current EXE, the logic is
void Openssl_uplink (volatile void **table, int index)
{
HANDLE h = getmodulehandle (NULL) GetProcAddress (H, "Openssl_applink") }
。 If you want to use it, you must also link MS/UPLINK.C when you link the exe. When Python uses m2crypto, if you manipulate the file, you can first create a Memorybuffer BIO object, and then read Memorybuffer as a string and manually write the string to the file.
Print "generating a private/public-bit key pair for Bob ..."Bob= M2Crypto.RSA.gen_key (1024, 65537)ifOs.name = ='NT': MB=M2Crypto.BIO.MemoryBuffer () bob.save_key_bio (MB, None) with open ('Bob-private.pem','WB') as F:f.write (Mb.read_all ())Else: Bob.save_key ('Bob-private.pem', None)