when i store a userPKCS12 binary file into the ldap directory using base64 encoding using the C LDAP API, the next time I try to retrieve the data, it is returned in base64 format; however, if insert the certificate using an ldif file from the command line and request the file using C, it comes back in binary format. i'm using the binary values as my LDAPMod ops, what am I doing wrong?
wyatt
Wyatt Neal wrote:
when i store a userPKCS12 binary file into the ldap directory using base64 encoding using the C LDAP API, the next time I try to retrieve the data, it is returned in base64 format; however, if insert the certificate using an ldif file from the command line and request the file using C, it comes back in binary format. i'm using the binary values as my LDAPMod ops, what am I doing wrong?
Nothing. The server sends the value in binary format; the library receives it in binary form; assuming you use ldapsearch to "retrieve the data", ldapsearch presents it in base64 because it's the only printable form it knows for non-printable values. Read ldapsearch(1) and specifically about -t/-T for saving binary-valued attributes, or write your own code.
p.
Ing. Pierangelo Masarati OpenLDAP Core Team
SysNet s.n.c. Via Dossi, 8 - 27100 Pavia - ITALIA http://www.sys-net.it ------------------------------------------ Office: +39.02.23998309 Mobile: +39.333.4963172 Email: pierangelo.masarati@sys-net.it ------------------------------------------
After further diving around in the code, I've got another question.
I have a LDAPMod pointer array that made up similarly to descript a structure that looks like this:
modsarray { op->add type->cname value->testname1 NULL op->add type->userpkcs12 bvalues->(base64 encoded binary data) NULL } NULL }
When I make the call to ldap_modify_ext_s, the vaules in the array stay intact though the first call, then the call to ldap_modify_ext, and right up to the ber_printf in modify.c; however, once ber_prinf is called in the ldap library, the modsarray[i]->type field gets corrupted with garbage data, but the values stay the same, resuting in a error 17 since the random binary data is obviously not a valid type. I'm running 2.3.27. Is it something with trying to mix binary attributes or what?
Thanks,
Wyatt
On 10/14/06, Pierangelo Masarati ando@sys-net.it wrote:
Wyatt Neal wrote:
when i store a userPKCS12 binary file into the ldap directory using base64 encoding using the C LDAP API, the next time I try to retrieve the data, it is returned in base64 format; however, if insert the certificate using an ldif file from the command line and request the file using C, it comes back in binary format. i'm using the binary values as my LDAPMod ops, what am I doing wrong?
Nothing. The server sends the value in binary format; the library receives it in binary form; assuming you use ldapsearch to "retrieve the data", ldapsearch presents it in base64 because it's the only printable form it knows for non-printable values. Read ldapsearch(1) and specifically about -t/-T for saving binary-valued attributes, or write your own code.
p.
Ing. Pierangelo Masarati OpenLDAP Core Team
SysNet s.n.c. Via Dossi, 8 - 27100 Pavia - ITALIA http://www.sys-net.it
Office: +39.02.23998309 Mobile: +39.333.4963172 Email: pierangelo.masarati@sys-net.it
openldap-software@openldap.org