Subject: | P_ASN1_UTCTIME_put2string fails to print dates out of 1950-2049 |
The reason is that Net::SSLeay::P_ASN1_UTCTIME_put2string() uses openssl function ASN1_UTCTIME_print which is able to operate only on ASN1_UTCTIME type limited to 1959-2049
My proposal is to introduce a new function based on ASN1_TIME_print (which handles both ASN1_UTCTIME + ASN1_GENERALIZEDTIME):
void
P_ASN1_TIME_put2string(tm)
ASN1_TIME * tm
PREINIT:
BIO *bp;
int i;
char buffer[256];
CODE:
bp = BIO_new(BIO_s_mem());
ASN1_TIME_print(bp,tm);
i = BIO_read(bp,buffer,255);
buffer[i] = '\0';
ST(0) = sv_newmortal(); /* Undefined to start with */
if ( i > 0 )
sv_setpvn( ST(0), buffer, i );
BIO_free(bp);
--
kmx
My proposal is to introduce a new function based on ASN1_TIME_print (which handles both ASN1_UTCTIME + ASN1_GENERALIZEDTIME):
void
P_ASN1_TIME_put2string(tm)
ASN1_TIME * tm
PREINIT:
BIO *bp;
int i;
char buffer[256];
CODE:
bp = BIO_new(BIO_s_mem());
ASN1_TIME_print(bp,tm);
i = BIO_read(bp,buffer,255);
buffer[i] = '\0';
ST(0) = sv_newmortal(); /* Undefined to start with */
if ( i > 0 )
sv_setpvn( ST(0), buffer, i );
BIO_free(bp);
--
kmx