[ program3r @ 25.12.2008. 16:57 ] @
Pozdrav svima nadam se da ce se nac netko tko ce mi znat rec u cemu grjesin Radim program za digitalni pecat i koristim se asimetricnim algoritmom rsa i asimetricnim aes i imam problem kod ovog drugog Evo izvorni kod using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Security.Cryptography; namespace Digitalni_potpis { class AES { public byte[] encryptStringToBytes_AES(string plainText, byte[] Key, byte[] IV) { RijndaelManaged Cipher = new RijndaelManaged(); ICryptoTransform Encryptor = Cipher.CreateEncryptor(Key, IV); MemoryStream mStream = new MemoryStream(); CryptoStream cStream = new CryptoStream(mStream, Encryptor, CryptoStreamMode.Write); byte[] plainBytes = UnicodeEncoding.Unicode.GetBytes(plainText); cStream.Write(plainBytes, 0, plainBytes.Length-1); cStream.FlushFinalBlock(); return mStream.ToArray(); } public string decryptStringFromBytes_AES(byte[] cipherText, byte[] Key, byte[] IV) { byte[] cipherBytes = cipherText; RijndaelManaged Cipher = new RijndaelManaged(); ICryptoTransform Decryptor = Cipher.CreateDecryptor(Key, IV); MemoryStream ms = new MemoryStream(cipherText); CryptoStream cs = new CryptoStream(ms, Decryptor, CryptoStreamMode.Read); byte[] plainBytes = new byte[cipherText.Length]; cs.Read(plainBytes, 0, cipherText.Length-1); return UnicodeEncoding.Unicode.GetString(plainBytes); } } } Prilikom debagiranja javi mi gresku da je padding invalid stavljao sam PaddingMode.PKCS7 i jos neke ponudene al ne ide Ako netko zna u cemu je rijec bio bih mu zahvalan Pozdrav |