------=_Part_363_23884333.1200583013140
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,
I have an issue altering an X509_CRL.

I open a crl from file, add some changes and write the resulting crl
somewhere.
However the changes I've done aren't in the resulting crl.

What am I missing ?

Thanks a lot,

Kris



#include
#include
#include
#include
#include
#include

int main(){
BIO * out = BIO_new_fp (stdout, BIO_NOCLOSE);
FILE *pFile;
if ((pFile = fopen("2004.crl", "rt"))) {
X509_CRL *y = d2i_X509_CRL_fp(pFile, 0);
fclose(pFile);
if(y) {
ASN1_TIME_free(y->crl->nextUpdate);
y->crl->nextUpdate = 0;
BIO_printf(out,"Next Update: ","");
if (X509_CRL_get_nextUpdate(y))
ASN1_TIME_print(out,X509_CRL_get_nextUpdate(y));
else BIO_printf(out,"NONE");
BIO_printf(out,"\n");

if ((pFile = fopen("/Users/kris/test.crl", "w"))) {
if(!i2d_X509_CRL_fp(pFile, y)) printf("Couldn't write\n");
else printf("Wrote file\n");
fclose(pFile);
} else printf("Couldn't open fd\n");
} else printf("Couldn't open crl\n");
if(y) X509_CRL_free(y);
y = 0;
} else printf("Couldn't open fd\n");
if ((pFile = fopen("/Users/kris/test.crl", "rt"))) {
X509_CRL *y = d2i_X509_CRL_fp(pFile, 0);
fclose(pFile);
if(y) {
BIO_printf(out,"Next Update: ","");
if (X509_CRL_get_nextUpdate(y))
ASN1_TIME_print(out,X509_CRL_get_nextUpdate(y));
else BIO_printf(out,"NONE");
BIO_printf(out,"\n");
} else printf("Couldn't open crl\n");
if(y) X509_CRL_free(y);
y = 0;
} else printf("Couldn't open fd\n");
}


------=_Part_363_23884333.1200583013140
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hi,

I have an issue altering an X509_CRL.

I open a crl from file, add some changes and write the resulting crl somewhere.
However the changes I've done aren't in the resulting crl. 

What am I missing ?

Thanks a lot,

Kris



<code>
#include <openssl/ocsp.h>
#include <openssl/asn1.h>
#include <openssl/pem.h>
#include <openssl/x509v3.h>
#include <openssl/err.h>
#include <string.h>

int main(){
    BIO * out = BIO_new_fp (stdout, BIO_NOCLOSE);
    FILE *pFile;
    if ((pFile = fopen("2004.crl", "rt"))) {
        X509_CRL *y = d2i_X509_CRL_fp(pFile, 0);
        fclose(pFile);
        if(y) {

            ASN1_TIME_free(y->crl->nextUpdate);
            y->crl->nextUpdate = 0;
            BIO_printf(out,"Next Update: ","");
            if (X509_CRL_get_nextUpdate(y)) ASN1_TIME_print(out,X509_CRL_get_nextUpdate(y));
            else BIO_printf(out,"NONE");
            BIO_printf(out,"\n");

            if ((pFile = fopen("/Users/kris/test.crl", "w"))) {
                if(!i2d_X509_CRL_fp(pFile, y)) printf("Couldn't write\n");
                else printf("Wrote file\n");
                fclose(pFile);
            } else printf("Couldn't open fd\n");
        } else printf("Couldn't open crl\n");
        if(y) X509_CRL_free(y);
        y = 0;
    } else printf("Couldn't open fd\n");
    if ((pFile = fopen("/Users/kris/test.crl", "rt"))) {
        X509_CRL *y = d2i_X509_CRL_fp(pFile, 0);
        fclose(pFile);
        if(y) {
            BIO_printf(out,"Next Update: ","");
            if (X509_CRL_get_nextUpdate(y)) ASN1_TIME_print(out,X509_CRL_get_nextUpdate(y));
            else BIO_printf(out,"NONE");
            BIO_printf(out,"\n");
        } else printf("Couldn't open crl\n");
        if(y) X509_CRL_free(y);
        y = 0;
    } else printf("Couldn't open fd\n");
}
</code>


------=_Part_363_23884333.1200583013140--
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majordomo@openssl.org