In message <40CD9A0B.5020608 / email.byu.edu>, `Jamis Buck <jgb3 / email.byu.edu>' wrote: > One other thing: I was advised off-list that the "crypt" method I added > is unecessary, and I have verified that this is true. My problem was > that I was not setting the padding. By setting the padding on the cipher > to 0, I can use update/final without any problems. I.e.: > > c = OpenSSL::Cipher::Cipher.new(...) > c.encrypt > c.key = ... > c.iv = ... > c.padding = 0 # <-- this is what I was missing > > v = c.update( .... ) << c.final > p v > > So... if you haven't already applied the patch, I can send you another > one. Or you can just remove the definition of that "crypt" method I added. No problem. ossl_cipher.c was rolled back. BTW, I'd like to change the type of the argument of Cipher#padding=. It should take a boolean but an integer. (patch is attaced.) # I'll add a workaround to treat backward compatibility if # it is applied to Ruby 1.8. regards, -- gotoyuzo --- ext/openssl/ossl_cipher.c 17 Sep 2003 09:05:02 -0000 1.4 +++ ext/openssl/ossl_cipher.c 14 Jun 2004 13:34:32 -0000 @@ -315,13 +282,16 @@ ossl_cipher_set_iv(VALUE self, VALUE iv) static VALUE ossl_cipher_set_padding(VALUE self, VALUE padding) { -#if defined(HAVE_ST_FLAGS) +#if defined(HAVE_ST_FLAGS) || OPENSSL_VERSION_NUMBER >= 0x0090702fL + /* + * EVP_CIPHER_CTX_set_padding existed in an earlier versions of openssl. + * I don't know the exact version number, but it does exist in 0x0090702fL. + */ EVP_CIPHER_CTX *ctx; GetCipher(self, ctx); - - if (EVP_CIPHER_CTX_set_padding(ctx, NUM2INT(padding)) != 1) - ossl_raise(eCipherError, NULL); + if (EVP_CIPHER_CTX_set_padding(ctx, RTEST(padding)) != 1) + ossl_raise(eCipherError, NULL); #else rb_notimplement(); #endif