[Date Prev][Date Next] [Chronological] [Thread] [Top]

add certificate



Hi,
I use openldap-1.2.4 to store certificates. If I use "ldapadd -b -f file1 -D "cn=root,c=CN" -w secret",I can see my entry from netscape 4.5's addressbook like below and everything is ok.
----------------------------------------------------------------------------------
				cert1
Name   cert1 
User Certificate  This Certificate belongs to:  This Certificate was issued by:                         	          SDT                    SDTCA
                       xl@SDT.COM                SDTCA@SDT.COM   
                        SDT                      RESEARCH  
                        WR, TR, CN               SDT                      			 						WR, TR, CN                                                         Serial Number: 07
                  This Certificate is valid from ?? 4?? 14, 1999 to ?? 4?? 13, 2000                		  Certificate Fingerprint:                    			50:34:1C:3E:91:E0:9D:CB:2A:0D:1D:2C:1E:17:12:29
                  Comment:
                        OpenSSL Generated Certificate
Object Class      authentication ---------------------------------------------------------------------------------

file1:
dn:cn=cert1,o=SDTech,c=CN
cn:cert1
userCertificate;binary:/home/openssl-0.9.3/certs/myca.cer
objectclass:authentication

But when I use the program which I write to add certificate, From Netscape I see attributes like below:
____________________________________________________________
			cert1
Name 	cert1
usercertificate   0?@0?? @0  *?H?¡Â 
Object Class   authentication 
____________________________________________________________
The lines which I think has relation to the problem is:
	LDAPMod         m[3];
	struct berval   *bvp,*b[2];
	......
	m[1].mod_op|=LDAP_MOD_BVALUES;
	printf("%d\n",m[1].mod_op);
        m[1].mod_type="usercertificate";
        b[0]=bvp;
        b[1]=NULL;
	m[1].mod_bvalues=b;
        ......
        
I print m[1].mod_op,it is -278256900.Then I change to "m[1].mod_op=LDAP_MOD_BVALUES" or
"m[1].mod_op=LDAP_MOD_ADD|LDAP_MOD_BVALUES", result of printf is 128.
Which is correct?
Why my program didn't have same effects as ldapadd command?       
Any help will be appreciated! 
----------------------------------------------
»¶Ó­Ê¹Óà 21CN µç×ÓÓʼþϵͳhttp://www.21cn.com
Thank you for using 21CN Email system