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>