|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
3DES and how to change mode and set IV.Hello, I need to crypt/decrypt with cryptlib, but I need to support all mode formats (cbc, ecb, ....) and IV's. I have read documentation, search into but I have no luck to get info on how to change cbc-mode or set the IV. I need a step by step functions to execute (an esquematic view)... I am doing my testing app on Delphi (pascal), but if functions come in C language I think I could convert it... Greetings and thanks... -- Fernando _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.Fernando Perez <fperez@...> writes:
>I need to crypt/decrypt with cryptlib, but I need to support all mode formats >(cbc, ecb, ....) and IV's. I have read documentation, search into but I >have no luck to get info on how to change cbc-mode or set the IV. I need a >step by step functions to execute (an esquematic view)... To set the IV, see "Working with Initialisation Vectors" in the manual, or "Conventional Encryption" for a complete code example. Here's a sample, for CBC mode: CRYPT_CONTEXT cryptContext; cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); cryptEncrypt( cryptContext, data, length ); cryptDestroyContext( cryptContext ); Peter. _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.Hello Peter, sorry my delay I have been testing and trying without
success... :-( Perhaps the big problem is that we are doing all of this on Delphi (object Pascal language) and we have not could to get this to work. Thanks anyway... Greetings.. Peter Gutmann escribió: > Fernando Perez <fperez@...> writes: > > >> I need to crypt/decrypt with cryptlib, but I need to support all mode formats >> (cbc, ecb, ....) and IV's. I have read documentation, search into but I >> have no luck to get info on how to change cbc-mode or set the IV. I need a >> step by step functions to execute (an esquematic view)... >> > > To set the IV, see "Working with Initialisation Vectors" in the manual, or > "Conventional Encryption" for a complete code example. Here's a sample, for > CBC mode: > > CRYPT_CONTEXT cryptContext; > > cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); > cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); > cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); > cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); > cryptEncrypt( cryptContext, data, length ); > cryptDestroyContext( cryptContext ); > > Peter. > > _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.The Delphi Interface for cryptlib contains all functions needed
for this job. But the "Delphi-like" interface DelphiCryptlib.pas with object oriented features for cryptlib does not contain methods for the low level features of cryptlib. But it is very simple to expand the objects and methods and implement any "missing" feature. I give you a sample for the low level encoding/decoding as suggested by Peter below. The Delphi interface module DelphiCryptlib.pas is available from my Delphi-cryptlib pages http://cryptlib.sogot.de Wolfgang Gothier -- Source samples: ------------------------------------------------------------------ program SampleForFernandoPerez; {$APPTYPE CONSOLE} uses SysUtils, DelphiCryptlib, cryptlib, LowLevelDelphiCryptlib in 'LowLevelDelphiCryptlib.pas'; var cryptContext: TCryptContext; key : AnsiString = 'My Special Key 1'; iv : array[0..7] of byte = (8,7,6,5,4,3,2,1); data: array[1..16] of byte = (0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5); begin try cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); with cryptContext do begin SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); SetAttributeString(CRYPT_CTXINFO_KEY, key); SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); Encrypt(@data, SizeOf(data)); end; cryptContext.Destroy; { the decryption follows as sample } cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); cryptContext.SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); cryptContext.SetAttributeString(CRYPT_CTXINFO_KEY, key); cryptContext.SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); cryptContext.Decrypt(@data, SizeOf(data)); cryptContext.Destroy; except on E:Exception do Writeln(E.Classname, ': ', E.Message); end; end. ------------------------------------------------------------------ ------------------------------------------------------------------ unit LowLevelDelphiCryptlib; interface uses DelphiCryptlib, cryptlib; type TCryptContext = class(TCryptObject) constructor Create(algo: CRYPT_ALGO_TYPE); procedure Encrypt(data: Pointer; length: Integer); procedure Decrypt(data: Pointer; length: Integer); end; implementation constructor TCryptContext.Create(algo: CRYPT_ALGO_TYPE); var err: Integer; begin err := cryptCreateContext(CryptHandle, CRYPT_UNUSED, algo); if err < 0 then raise ECryptError.Create(err, 'cryptCreateContext'); end; procedure TCryptContext.Encrypt(data: Pointer; length: Integer); var err: Integer; begin err := cryptEncrypt( CryptHandle, data, length ); if err < 0 then raise ECryptError.Create(err, 'cryptEncrypt'); end; procedure TCryptContext.Decrypt(data: Pointer; length: Integer); var err: Integer; begin err := cryptDecrypt( CryptHandle, data, length ); if err < 0 then raise ECryptError.Create(err, 'cryptDecrypt'); end; end. ------------------------------------------------------------------ -------- Original Message -------- Subject: Re: [Cryptlib] 3DES and how to change mode and set IV. From: Fernando Perez <fperez@...> To: Peter Gutmann <pgut001@...> Date: Wed Sep 02 2009 16:46:17 GMT+0200 > Hello Peter, sorry my delay I have been testing and trying without > success... :-( > > Perhaps the big problem is that we are doing all of this on Delphi > (object Pascal language) and we have not could to get this to work. > > Thanks anyway... > > Greetings.. > > > > > > Peter Gutmann escribió: >> Fernando Perez <fperez@...> writes: >> >> >>> I need to crypt/decrypt with cryptlib, but I need to support all mode >>> formats >>> (cbc, ecb, ....) and IV's. I have read documentation, search into >>> but I >>> have no luck to get info on how to change cbc-mode or set the IV. I >>> need a >>> step by step functions to execute (an esquematic view)... >>> >> >> To set the IV, see "Working with Initialisation Vectors" in the >> manual, or >> "Conventional Encryption" for a complete code example. Here's a >> sample, for >> CBC mode: >> >> CRYPT_CONTEXT cryptContext; >> >> cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); >> cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); >> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); >> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); >> cryptEncrypt( cryptContext, data, length ); >> cryptDestroyContext( cryptContext ); >> >> Peter. _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.Hello Wolfgang, first of all, thanks by your example...
I have tried this: ================== procedure TForm3.DoEncrypt(InputFilename: string; OutputFilename: string; MyPassword: string); var cryptContext : TCryptContext; key : AnsiString; data : TMemoryStream; begin data := TMemoryStream.Create; data.LoadFromFile(InputFileName); key := MyPassword; try cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); try cryptContext.SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_ECB)); cryptContext.SetAttributeString(CRYPT_CTXINFO_KEY, key); //---> ECB mode --- cryptContext.SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); cryptContext.Encrypt(@data, data.size); // Here the error... finally cryptContext.Destroy; end; data.SaveToFile(OutputFilename); except on E:Exception do ShowMessage(E.ClassName + ': ' + E.Message); end; end; ================== But I have _always_ the error: Bad argument, parameter 3 but I don't know what is the parameter 3. Greetings... GMX escribió: > The Delphi Interface for cryptlib contains all functions needed > for this job. But the "Delphi-like" interface DelphiCryptlib.pas > with object oriented features for cryptlib does not contain > methods for the low level features of cryptlib. > > But it is very simple to expand the objects and methods and > implement any "missing" feature. I give you a sample for the > low level encoding/decoding as suggested by Peter below. > > The Delphi interface module DelphiCryptlib.pas is available > from my Delphi-cryptlib pages http://cryptlib.sogot.de > > Wolfgang Gothier > -- > > Source samples: > ------------------------------------------------------------------ > program SampleForFernandoPerez; > > {$APPTYPE CONSOLE} > > uses > SysUtils, > DelphiCryptlib, > cryptlib, > LowLevelDelphiCryptlib in 'LowLevelDelphiCryptlib.pas'; > > var > cryptContext: TCryptContext; > key : AnsiString = 'My Special Key 1'; > iv : array[0..7] of byte = (8,7,6,5,4,3,2,1); > data: array[1..16] of byte = (0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5); > > begin > try > cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); > with cryptContext do begin > SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); > SetAttributeString(CRYPT_CTXINFO_KEY, key); > SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); > Encrypt(@data, SizeOf(data)); > end; > cryptContext.Destroy; > > { the decryption follows as sample } > cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); > cryptContext.SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); > cryptContext.SetAttributeString(CRYPT_CTXINFO_KEY, key); > cryptContext.SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); > cryptContext.Decrypt(@data, SizeOf(data)); > cryptContext.Destroy; > > except > on E:Exception do > Writeln(E.Classname, ': ', E.Message); > end; > end. > > ------------------------------------------------------------------ > ------------------------------------------------------------------ > > unit LowLevelDelphiCryptlib; > > interface > > uses > DelphiCryptlib, > cryptlib; > > type > TCryptContext = class(TCryptObject) > constructor Create(algo: CRYPT_ALGO_TYPE); > procedure Encrypt(data: Pointer; length: Integer); > procedure Decrypt(data: Pointer; length: Integer); > end; > > implementation > > constructor TCryptContext.Create(algo: CRYPT_ALGO_TYPE); > var > err: Integer; > begin > err := cryptCreateContext(CryptHandle, CRYPT_UNUSED, algo); > if err < 0 then > raise ECryptError.Create(err, 'cryptCreateContext'); > end; > > procedure TCryptContext.Encrypt(data: Pointer; length: Integer); > var > err: Integer; > begin > err := cryptEncrypt( CryptHandle, data, length ); > if err < 0 then > raise ECryptError.Create(err, 'cryptEncrypt'); > end; > > procedure TCryptContext.Decrypt(data: Pointer; length: Integer); > var > err: Integer; > begin > err := cryptDecrypt( CryptHandle, data, length ); > if err < 0 then > raise ECryptError.Create(err, 'cryptDecrypt'); > end; > > end. > ------------------------------------------------------------------ > > > -------- Original Message -------- > Subject: Re: [Cryptlib] 3DES and how to change mode and set IV. > From: Fernando Perez <fperez@...> > To: Peter Gutmann <pgut001@...> > Date: Wed Sep 02 2009 16:46:17 GMT+0200 > > >> Hello Peter, sorry my delay I have been testing and trying without >> success... :-( >> >> Perhaps the big problem is that we are doing all of this on Delphi >> (object Pascal language) and we have not could to get this to work. >> >> Thanks anyway... >> >> Greetings.. >> >> >> >> >> >> Peter Gutmann escribió: >> >>> Fernando Perez <fperez@...> writes: >>> >>> >>> >>>> I need to crypt/decrypt with cryptlib, but I need to support all mode >>>> formats >>>> (cbc, ecb, ....) and IV's. I have read documentation, search into >>>> but I >>>> have no luck to get info on how to change cbc-mode or set the IV. I >>>> need a >>>> step by step functions to execute (an esquematic view)... >>>> >>>> >>> To set the IV, see "Working with Initialisation Vectors" in the >>> manual, or >>> "Conventional Encryption" for a complete code example. Here's a >>> sample, for >>> CBC mode: >>> >>> CRYPT_CONTEXT cryptContext; >>> >>> cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); >>> cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); >>> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); >>> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); >>> cryptEncrypt( cryptContext, data, length ); >>> cryptDestroyContext( cryptContext ); >>> >>> Peter. >>> > > > _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.I have found what is parameter 3 error:
"Loading a key will return a CRYPT_ERROR_PARAM3 error if the key is a weak key. cryptExportKey will export the correct parity-adjusted version of the key." Hummm.... My test password is (text plain): 12345678abcdefgh87654321 I think this is not a weak key... Thanks in advance... Fernando Perez escribió: > Hello Wolfgang, first of all, thanks by your example... > > I have tried this: > > ================== > procedure TForm3.DoEncrypt(InputFilename: string; OutputFilename: > string; MyPassword: string); > var > cryptContext : TCryptContext; > key : AnsiString; > data : TMemoryStream; > > begin > data := TMemoryStream.Create; > data.LoadFromFile(InputFileName); > > key := MyPassword; > > try > cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); > try > > cryptContext.SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_ECB)); > cryptContext.SetAttributeString(CRYPT_CTXINFO_KEY, key); > //---> ECB mode --- > cryptContext.SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); > cryptContext.Encrypt(@data, data.size); // Here the error... > > finally > cryptContext.Destroy; > end; > data.SaveToFile(OutputFilename); > except > on E:Exception do > ShowMessage(E.ClassName + ': ' + E.Message); > end; > end; > ================== > > But I have _always_ the error: > Bad argument, parameter 3 > > but I don't know what is the parameter 3. > > Greetings... > > GMX escribió: > >> The Delphi Interface for cryptlib contains all functions needed >> for this job. But the "Delphi-like" interface DelphiCryptlib.pas >> with object oriented features for cryptlib does not contain >> methods for the low level features of cryptlib. >> >> But it is very simple to expand the objects and methods and >> implement any "missing" feature. I give you a sample for the >> low level encoding/decoding as suggested by Peter below. >> >> The Delphi interface module DelphiCryptlib.pas is available >> from my Delphi-cryptlib pages http://cryptlib.sogot.de >> >> Wolfgang Gothier >> -- >> >> Source samples: >> ------------------------------------------------------------------ >> program SampleForFernandoPerez; >> >> {$APPTYPE CONSOLE} >> >> uses >> SysUtils, >> DelphiCryptlib, >> cryptlib, >> LowLevelDelphiCryptlib in 'LowLevelDelphiCryptlib.pas'; >> >> var >> cryptContext: TCryptContext; >> key : AnsiString = 'My Special Key 1'; >> iv : array[0..7] of byte = (8,7,6,5,4,3,2,1); >> data: array[1..16] of byte = (0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5); >> >> begin >> try >> cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); >> with cryptContext do begin >> SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); >> SetAttributeString(CRYPT_CTXINFO_KEY, key); >> SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); >> Encrypt(@data, SizeOf(data)); >> end; >> cryptContext.Destroy; >> >> { the decryption follows as sample } >> cryptContext := TCryptContext.Create(CRYPT_ALGO_3DES); >> cryptContext.SetAttribute(CRYPT_CTXINFO_MODE, ord(CRYPT_MODE_CBC)); >> cryptContext.SetAttributeString(CRYPT_CTXINFO_KEY, key); >> cryptContext.SetAttributeBinary(CRYPT_CTXINFO_IV, @iv, 8); >> cryptContext.Decrypt(@data, SizeOf(data)); >> cryptContext.Destroy; >> >> except >> on E:Exception do >> Writeln(E.Classname, ': ', E.Message); >> end; >> end. >> >> ------------------------------------------------------------------ >> ------------------------------------------------------------------ >> >> unit LowLevelDelphiCryptlib; >> >> interface >> >> uses >> DelphiCryptlib, >> cryptlib; >> >> type >> TCryptContext = class(TCryptObject) >> constructor Create(algo: CRYPT_ALGO_TYPE); >> procedure Encrypt(data: Pointer; length: Integer); >> procedure Decrypt(data: Pointer; length: Integer); >> end; >> >> implementation >> >> constructor TCryptContext.Create(algo: CRYPT_ALGO_TYPE); >> var >> err: Integer; >> begin >> err := cryptCreateContext(CryptHandle, CRYPT_UNUSED, algo); >> if err < 0 then >> raise ECryptError.Create(err, 'cryptCreateContext'); >> end; >> >> procedure TCryptContext.Encrypt(data: Pointer; length: Integer); >> var >> err: Integer; >> begin >> err := cryptEncrypt( CryptHandle, data, length ); >> if err < 0 then >> raise ECryptError.Create(err, 'cryptEncrypt'); >> end; >> >> procedure TCryptContext.Decrypt(data: Pointer; length: Integer); >> var >> err: Integer; >> begin >> err := cryptDecrypt( CryptHandle, data, length ); >> if err < 0 then >> raise ECryptError.Create(err, 'cryptDecrypt'); >> end; >> >> end. >> ------------------------------------------------------------------ >> >> >> -------- Original Message -------- >> Subject: Re: [Cryptlib] 3DES and how to change mode and set IV. >> From: Fernando Perez <fperez@...> >> To: Peter Gutmann <pgut001@...> >> Date: Wed Sep 02 2009 16:46:17 GMT+0200 >> >> >> >>> Hello Peter, sorry my delay I have been testing and trying without >>> success... :-( >>> >>> Perhaps the big problem is that we are doing all of this on Delphi >>> (object Pascal language) and we have not could to get this to work. >>> >>> Thanks anyway... >>> >>> Greetings.. >>> >>> >>> >>> >>> >>> Peter Gutmann escribió: >>> >>> >>>> Fernando Perez <fperez@...> writes: >>>> >>>> >>>> >>>> >>>>> I need to crypt/decrypt with cryptlib, but I need to support all mode >>>>> formats >>>>> (cbc, ecb, ....) and IV's. I have read documentation, search into >>>>> but I >>>>> have no luck to get info on how to change cbc-mode or set the IV. I >>>>> need a >>>>> step by step functions to execute (an esquematic view)... >>>>> >>>>> >>>>> >>>> To set the IV, see "Working with Initialisation Vectors" in the >>>> manual, or >>>> "Conventional Encryption" for a complete code example. Here's a >>>> sample, for >>>> CBC mode: >>>> >>>> CRYPT_CONTEXT cryptContext; >>>> >>>> cryptCreateContext( &cryptContext, CRYPT_UNUSED, CRYPT_ALGO_3DES ); >>>> cryptSetAttribute( cryptContext, CRYPT_CTXINFO_MODE, CRYPT_MODE_CBC ); >>>> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_KEY, key, 16 ); >>>> cryptSetAttributeString( cryptContext, CRYPT_CTXINFO_IV, iv, 8 ); >>>> cryptEncrypt( cryptContext, data, length ); >>>> cryptDestroyContext( cryptContext ); >>>> >>>> Peter. >>>> >>>> >> >> > > _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.No, that is definitely not the reason for CRYPT_ERROR_PARAM3.
The paramter counting is a bit tricky when using DelphiCryptlib.pas: There is a first "hidden" parameter, the cryptContext handle! Thats why the SECOND Delphi parameter (data.size) is in error. I think, you forgot the padding bytes at the end in case the file length is not a multiple of the blocksize. I can't understand why you try to reinvent the wheel. Why don't you use the high level envelope functions? They handle all these special cases like IV and blocksize and maximal buffer length. Wolfgang Gothier -------- Original Message -------- Subject: Re: [Cryptlib] 3DES and how to change mode and set IV. From: Fernando Perez <fperez@...> To: GMX <mailist@...> Date: Thu Sep 03 2009 23:57:47 GMT+0200 > I have found what is parameter 3 error: > > "Loading a key will return a CRYPT_ERROR_PARAM3 error if the key is a weak > key. cryptExportKey will export the correct parity-adjusted version of > the key." > > Hummm.... My test password is (text plain): > 12345678abcdefgh87654321 > > I think this is not a weak key... > > Thanks in advance... _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
|
|
Re: 3DES and how to change mode and set IV.I did found the explanation to CRYPT_ERROR_PARAM3 on the cryptlib
manual/help. Thanks for the explanation Wolfgang. I know I could use envelope functions but I need "complete" control over the process, padding, IV and crypt-mode (ecb, cbc and so on)... It is a bit difficult to explain and I cannot do it on a mailing list. I will send you a private mail. Thanks again... GMX escribió: > No, that is definitely not the reason for CRYPT_ERROR_PARAM3. > The paramter counting is a bit tricky when using DelphiCryptlib.pas: > There is a first "hidden" parameter, the cryptContext handle! > Thats why the SECOND Delphi parameter (data.size) is in error. > I think, you forgot the padding bytes at the end in case the file > length is not a multiple of the blocksize. > > I can't understand why you try to reinvent the wheel. Why don't > you use the high level envelope functions? They handle all these > special cases like IV and blocksize and maximal buffer length. > > Wolfgang Gothier > > -------- Original Message -------- > Subject: Re: [Cryptlib] 3DES and how to change mode and set IV. > From: Fernando Perez <fperez@...> > To: GMX <mailist@...> > Date: Thu Sep 03 2009 23:57:47 GMT+0200 > > >> I have found what is parameter 3 error: >> >> "Loading a key will return a CRYPT_ERROR_PARAM3 error if the key is a weak >> key. cryptExportKey will export the correct parity-adjusted version of >> the key." >> >> Hummm.... My test password is (text plain): >> 12345678abcdefgh87654321 >> >> I think this is not a weak key... >> >> Thanks in advance... >> > > > > _______________________________________________ > Cryptlib mailing list > Cryptlib@... via Mail: cryptlib-request@... > Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ > http://news.gmane.org/gmane.comp.encryption.cryptlib > Posts from non-subscribed addresses are blocked to prevent spam, please > subscribe in order to post messages. > > _______________________________________________ Cryptlib mailing list Cryptlib@... via Mail: cryptlib-request@... Archive: ftp://ftp.franken.de/pub/crypt/cryptlib/archives/ http://news.gmane.org/gmane.comp.encryption.cryptlib Posts from non-subscribed addresses are blocked to prevent spam, please subscribe in order to post messages. |
| Free embeddable forum powered by Nabble | Forum Help |