mfpierre / go-mcrypt

Go bindings for mcrypt library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Puzzled: Invalid key length

haowanxing opened this issue · comments

First of all. thanks for that you provide this project. it's very helpful ! and I hope that you can understand what i have writen. cuz my english is not so well. :)

well, i have a problem when i do the decrypt&encrypt with this tool .
the function: mcrypt_enc_get_key_size which returns a integer of "Default Key Size". The question is, when i choose Rijndael-128 as CipherName. The requiredKeySize must be 32. Dose that mean 16 or 24 is not supported ?

so. i have to do something like this :

if (keyLength > requiredKeySize) {
	*err = INVALID_KEY_LENGTH;
	mcrypt_module_close(td);
	return NULL;
}

and i also knew that is not right :(