Dkim Generator..

Hi there,

I'm trying to generate the keys (private, public) for using on another
dns, just like a wizard, I'm doing in this way, but the reflectors
keep saying "Bad keys", how can I make this ?

openssl = OpenSSL::PKey::RSA.generate(1024)
openssl_pub = openssl.public_key.to_pem

The error:

permerror (invalid key: error reading public key:
3077860240:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong
tag:tasn_dec.c:1319:;3077860240:error:0D07803A:asn1 encoding
routines:ASN1_ITEM_EX_D2I:nested asn1
error:tasn_dec.c:381:Type=X509_ALGOR;3077860240:error:0D08303A:asn1
encoding
routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:
751:Field=algor,
Type=X509_PUBKEY;3077860240:error:0D0680A8:asn1 encoding
routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1319:;3077860240:error:
0D07803A:asn1
encoding routines:ASN1_ITEM_EX_D2I:nested asn1
error:tasn_dec.c:381:Type=X509_ALGOR;3077860240:error:0D08303A:asn1
encoding
routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error:tasn_dec.c:
751:Field=algor,
Type=X509_PUBKEY;)

The question is, I'm generating the key as is supposed to be?

Thanks.
Regards.

Gabriel.