|
27. 01. 2016. | #1 |
profesionalac
Professional
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
|
Source array was not long enough
Pozdrav svima.
Imam exception na metodu ispod. Sta sa nizom nije dovoljno "long"? Evo print-screen exception-a: http://picpaste.com/Screenshot_7-dFA8Vq9P.png Hvala unapred. Kôd:
public static CryptoStream GetCryptoReadStream( Stream stream ) { ICryptoTransform encryptor; Byte[] byteName; Byte[] byteSerial; byteName=new Byte[32]; byteName.Initialize(); byteSerial=new Byte[16]; byteSerial.Initialize(); Array.Copy(Encoding.ASCII.GetBytes(Settings.Name),0,byteName,0, Math.Min(Encoding.ASCII.GetBytes(Settings.Name).Length,32)); Array.Copy(Encoding.ASCII.GetBytes(Settings.Serial),0,byteSerial,0,16); RijndaelManaged rm; rm=new RijndaelManaged(); encryptor=rm.CreateDecryptor(byteName,byteSerial); CryptoStream cryptoStream; cryptoStream=new CryptoStream(stream,encryptor,CryptoStreamMode.Read); return cryptoStream; } |
30. 01. 2016. | #2 |
emperor Selassie
Grand Master
|
Na prvu bih rekao da brojanje ide od 0 do 15, tako da probaj da staviš 15 umesto 16
|
143 članova zahvaljuje Nemanja Avramović za poruku: |
31. 01. 2016. | #3 |
profesionalac
Professional
Datum učlanjenja: 30.08.2010
Poruke: 201
Hvala: 10
640 "Hvala" u 14 poruka
|
Hvala sto se trudis.
Na koji niz konkretno mislis? byteSerial? Kôd:
byteSerial=new Byte[15]; . . . Array.Copy(Encoding.ASCII.GetBytes(Settings.Name),0,byteName,0, Math.Min(Encoding.ASCII.GetBytes(Settings.Name).Length,32)); Array.Copy(Encoding.ASCII.GetBytes(Settings.Serial),0,byteSerial,0,15); Hvala jos jednom |
129 članova zahvaljuje slavkan za poruku: |
13. 02. 2016. | #4 |
emperor Selassie
Grand Master
|
Mislio sam na
Kôd:
Array.Copy(Encoding.ASCII.GetBytes(Settings.Serial),0,byteSerial,0,16); |
104 članova zahvaljuje Nemanja Avramović za poruku: |
|
|