c# - Unable to call com registered dll function in php -
i have completed com registration of dll file , showing in registry(which got after entering regedit
in command prompt)
if use $obj1 = new com("encryptiondll.clsencryption");
getting no error
when trying access method(which declared public string in .net) getting following error php code
fatal error: call undefined method com::encrypt12() in c:\xampp\htdocs\test1\index.php on line 12
please help
below c# code used constract dll:
using system; using system.collections.generic; using system.io; using system.linq; using system.security.cryptography; using system.text; using system.threading.tasks; namespace encryptiondll { public class clsencryption { public static void main(string[] args) { } public static string encrypt12(string plaintext) { asciiencoding textconverter = new asciiencoding(); byte[] key = textconverter.getbytes("2a1c907916add59edffb3a4b"); byte[] iv = textconverter.getbytes("00000000"); byte[] cleardata = encoding.ascii.getbytes(plaintext); byte[] cipherdata = encrypt1(cleardata, key, iv); return convert.tobase64string(cipherdata); } public static byte[] encrypt1(byte[] cleardata, byte[] key, byte[] iv) { memorystream ms = new memorystream(); tripledescryptoserviceprovider tdes = new tripledescryptoserviceprovider(); tdes.mode = ciphermode.ecb; tdes.padding = paddingmode.pkcs7; icryptotransform alg = tdes.createencryptor(key, iv); cryptostream cs = new cryptostream(ms, alg, cryptostreammode.write); cs.write(cleardata, 0, cleardata.length); cs.flushfinalblock(); cs.close(); byte[] encrypteddata = ms.toarray(); return encrypteddata; } } }
Comments
Post a Comment