188
188
189
189
# #####################################################################
190
190
191
- VERSION=" 1.8 "
191
+ VERSION=" 1.10 "
192
192
193
193
showhelp ()
194
194
{
291
291
;;
292
292
certify)
293
293
$CAT << EOF
294
- Usage: clca certify --profile <name> [--startdate YYMMDDHHMMSS ] [--enddate YYMMDDHHMMSS ] [--reqformat P10|SSCERT|KEY] [--subject <subject>] [--san TYPE:SAN] [--batch] <request file>
294
+ Usage: clca certify --profile <name> [--startdate DATESPEC ] [--enddate DATESPEC ] [--reqformat P10|SSCERT|KEY] [--subject <subject>] [--san TYPE:SAN] [--batch] <request file>
295
295
296
296
Signs a PKCS#10 certificate request (DER/PEM format is automatically
297
297
detected). Certificate extensions and validity are determined by
@@ -333,8 +333,8 @@ The certificate database is updated and a copy of the certificate
333
333
is written to the file 'newcert.pem' in the current directory.
334
334
335
335
If --startdate or --enddate are specified, these dates are used for
336
- the certificate's lifetime. The dates must be specified in the format
337
- YYMMDDHHMMSS and are interpreted as UTC times.
336
+ the certificate's lifetime. The dates must be specified in the DATESPEC
337
+ format and are interpreted as UTC times.
338
338
The date specification can be abbreviated by omitting parts of the
339
339
date/time specification (e. g. "YYMM" only). Omitted date/time components
340
340
are initialized to the lowest possible value.
@@ -351,6 +351,7 @@ clca certify --profile endentity
351
351
--san "otherName:1.3.6.1.4.1.311.20.2.3;UTF8:[email protected] " foo.csr
352
352
353
353
EOF
354
+ showhelp datespec
354
355
;;
355
356
revoke)
356
357
$CAT << EOF
380
381
;;
381
382
initialize)
382
383
$CAT << EOF
383
- Usage: clca initialize [--req <filename>] [--startdate YYMMDDHHMMSS ] [--enddate YYMMDDHHMMSS ]
384
+ Usage: clca initialize [--req <filename>] [--startdate DATESPEC ] [--enddate DATESPEC ]
384
385
385
386
Initializes the CA database and creates either a self-signed certificate
386
387
or a PKCS#10 certificate request.
@@ -421,6 +422,7 @@ The following steps must be performed to create a CA:
421
422
3. Create the CA using the initialize command
422
423
423
424
EOF
425
+ showhelp datespec
424
426
;;
425
427
check)
426
428
$CAT << EOF
@@ -452,7 +454,31 @@ YYYYMMDDHHMMSS-clca-backup.tar.gz in the current directory (caps replaced
452
454
with timestamp).
453
455
EOF
454
456
;;
455
-
457
+ datespec)
458
+ $CAT << EOF
459
+ DATESPEC
460
+ A DATESPEC is an absolute timestamp representing a point in time. Two different
461
+ formats are supported:
462
+
463
+ Truncated format ("traditional") format: YY[MM[DD[HH[MM]SS[Z]]]]]
464
+ The truncated format uses a two-digit year representation and optionally allows
465
+ any number of two-digit date/time specification components up to seconds.
466
+ It is possible to specify only portions of the date, starting from the
467
+ left-hand side and leaving out the lower tier date components, e. g. "YY" or
468
+ "YYMMDD".
469
+ The missing date elements are implicitly filled with the lowest sensible value
470
+ (01 for months and days, 00 for hours, minutes and seconds).
471
+
472
+ Complete format: YYYYMMDDHHMMSS[Z]
473
+ If the specified timestamp is exactly 14 digits long it is assumed to contain
474
+ a full date/time specification. A trailing "Z" is optional (see "Time zone").
475
+
476
+ Time zone:
477
+ A full DATESPEC always contains a time zone specification which is following the
478
+ actual timestamp value. It may be omitted when specifying the timestamp on the command
479
+ line. The default time zone is "Z" and specifies the UTC (Zulu) time zone.
480
+
481
+ EOF
456
482
esac
457
483
}
458
484
529
555
fi
530
556
}
531
557
532
- # arg: user specified date , format YYMMDDHHMMSSZ
558
+ # arg: DATESPEC , format YY[MM[DD[HH[MM]SS[Z]]]]] or YYYYMMDDHHMMSS[Z]
533
559
# It is possible to specify only portions of the date,
534
560
# starting from the left-hand side and leave out the
535
561
# lower tier date components, e. g. "YY" or "YYMMDD".
@@ -539,18 +565,33 @@ EOF
539
565
sanitize_openssl_date () {
540
566
$PERL -e '
541
567
my $date = shift;
542
- my ($yy, $mm, $dd, $hh, $min, $ss, $z) = ($date =~ m{^(\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?(Z)?$});
543
568
569
+ my $yy;
570
+ my $mm;
571
+ my $dd;
572
+ my $hh;
573
+ my $min;
574
+ my $ss;
575
+ my $z;
576
+
577
+ # check for YYYYMMDDHHMMSS[Z] syntax
578
+ ($yy, $mm, $dd, $hh, $min, $ss, $z) = ($date =~ m{^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(Z)?$});
579
+
580
+ # not a complete date spec, try the traditional (possibly truncated) one
544
581
if (! defined $yy) {
545
- print STDERR "ERROR: specified date is not of the form YYMMDDHHMMSSZ (or a subset)\n";
582
+ ($yy, $mm, $dd, $hh, $min, $ss, $z) = ($date =~ m{^(\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?(Z)?$});
583
+ }
584
+
585
+ if (! defined $yy) {
586
+ print STDERR "ERROR: specified date is not of the form YY[MM[DD[HH[MM[SS[Z]]]]]] or YYYYMMDDHHMMSS[Z]\n";
546
587
exit 1;
547
588
}
548
589
549
- if ($yy < 10 || $yy > 50) {
550
- print STDERR "WARNING: Year 20$yy in date specification. Please double-check.\n";
590
+ if ($yy < 10 || ( $yy > 50 && $yy < 100) ) {
591
+ print STDERR "WARNING: Year 20$yy used in traditional date specification. Please double-check.\n";
551
592
}
552
593
if ($yy == 20) {
553
- print STDERR "WARNING: Year 2020 specified. Please double-check.\n";
594
+ print STDERR "WARNING: Year 2020 specified in traditional date spec . Please double-check.\n";
554
595
}
555
596
$mm = "01" unless defined $mm;
556
597
$dd = "01" unless defined $dd;
@@ -1503,6 +1544,10 @@ check()
1503
1544
showhelp check
1504
1545
abort 1
1505
1546
;;
1547
+ --testdate)
1548
+ sanitize_openssl_date $2
1549
+ abort 0
1550
+ ;;
1506
1551
* )
1507
1552
showhelp check
1508
1553
abort 1
0 commit comments