On Fri, Feb 16, 2007, Andrew Brampton wrote: > Hi, > I don't know if I'm doing this correctly, but when I call X509_dup on a > X509 object that has been recently created it returns NULL. For example > > X509 *x1 = X509_new(); > X509 *x2 = X509_dup ( x1 ); > // x2 is null, indicating a duplication error > > Now it will always return NULL unless I set the validity period first, i.e.: > X509 *x1 = X509_new(); > X509_gmtime_adj(X509_get_notBefore(x1), 0); > X509_gmtime_adj(X509_get_notAfter(x1), 0); > X509 *x2 = X509_dup ( x1 ); > // x2 is not null > > It also seems no matter what other fields I set on the X509 object it will > not duplicate unless the validity is set. This caused a minor problem in my > program, which I was able to avoid. >
The validity period is a mandatory field for an X509 object. Without this it isn't a valid certificate. That's why it wont dup. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED]
