<br><br><div class="gmail_quote">On Mon, Feb 13, 2012 at 8:23 AM, Willem Toorop <span dir="ltr"><<a href="mailto:Willem@nlnetlabs.nl">Willem@nlnetlabs.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Kaustubh,<br>
<br>
Sorry for my late response. If you are reading the with<br>
        dnssec-keygen -n HOST<br>
generated<br>
        K<zone>+<alg>+<keytag>.private<br>
file with ldns_key_new_frm_fp then there is no way to set the name of<br>
the key (which is the <zone> part of the filename b.t.w.) because it is<br>
simply not in the file content.<br>
<br>
Also, it is rather cumbersome to extract even the keyname:<br>
<br>
ldns_key* key;<br>
<br>
size_t i = ldns_key_hmac_size(key);<br>
ldns_rdf* b64_bignum = ldns_rdf_new_frm_data( LDNS_RDF_TYPE_B64, i<br>
                                            , ldns_key_hmac_key(key));<br>
char* keyname = ldns_rdf2str(b64_bignum);<br>
<br>
Maybe it would be more convenient to read the K<zone>+<alg>+<keytag>.key<br>
file in stead with ldns_key_new_frm_fp. keyname and keydata can then<br>
simply be extracted with:<br>
<br>
ldns_rr* key_rr;<br></blockquote><div><br></div><div>How would I populate this rr?</div><div><br></div><div>Thanks,</div><div>Kaustubh</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
char* keyname = ldns_rdf2str(ldns_rr_owner(key_rr));<br>
char* keydata = ldns_rdf2str(ldns_rr_rdf(key_rr, 3));<br>
<br>
Good luck!<br>
<br>
-- Willem<br>
<br>
Op 04-02-12 00:46, Kaustubh Gadkari schreef:<br>
<div><div class="h5">> Hi,<br>
><br>
> I am trying to verify the tsig of a packet that I have received from a<br>
> client. For the shared key, I use a key generated with dnssec-keygen.<br>
> At my server side, I read the this key into an ldns_key structure<br>
> using ldns_key_new_frm_fp() function. I want to use this key to verify<br>
> the packet's tsig using the ldns_pkt_tsig_verify() function. This<br>
> function asks for the key name, which I tried to get using the<br>
> ldns_key_get_file_base_name(), but I get an assertion error for rd !=<br>
> 0.<br>
><br>
> What is the correct way to get the key name and key mac to use with<br>
> the ldns_pkt_tsig_verify() function?<br>
><br>
> Thanks,<br>
> Kaustubh<br>
><br>
><br>
> --<br>
> Kaustubh Gadkari<br>
</div></div>> _______________________________________________<br>
> ldns-users mailing list<br>
> <a href="mailto:ldns-users@open.nlnetlabs.nl">ldns-users@open.nlnetlabs.nl</a><br>
> <a href="http://open.nlnetlabs.nl/mailman/listinfo/ldns-users" target="_blank">http://open.nlnetlabs.nl/mailman/listinfo/ldns-users</a><br>
<br>
_______________________________________________<br>
ldns-users mailing list<br>
<a href="mailto:ldns-users@open.nlnetlabs.nl">ldns-users@open.nlnetlabs.nl</a><br>
<a href="http://open.nlnetlabs.nl/mailman/listinfo/ldns-users" target="_blank">http://open.nlnetlabs.nl/mailman/listinfo/ldns-users</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Kaustubh Gadkari<br><br>