mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 08:58:30 +01:00
Update to understand Generalized / UTC Time
Future proofing for when certificates with dates after 2049 begin being issued. These certificates' dates will be in Generalized Time not UTC Time as per RFC 5280
This commit is contained in:
parent
688c2d0df5
commit
40acf751a8
1 changed files with 12 additions and 6 deletions
|
@ -206,13 +206,19 @@ ${extensions}`;
|
|||
* @returns {string}
|
||||
*/
|
||||
function formatDate (dateStr) {
|
||||
return dateStr[4] + dateStr[5] + "/" +
|
||||
dateStr[2] + dateStr[3] + "/" +
|
||||
(dateStr[0] < "5" ? "20" : "19") +
|
||||
dateStr[0] + dateStr[1] + " " +
|
||||
dateStr[6] + dateStr[7] + ":" +
|
||||
if (dateStr.length === 13) { // UTC Time
|
||||
if (dateStr[0] < "5") {
|
||||
dateStr = "20" + dateStr;
|
||||
} else {
|
||||
dateStr = "19" + dateStr;
|
||||
}
|
||||
}
|
||||
return dateStr[6] + dateStr[7] + "/" +
|
||||
dateStr[4] + dateStr[5] + "/" +
|
||||
dateStr[0] + dateStr[1] + dateStr[2] + dateStr[3] + " " +
|
||||
dateStr[8] + dateStr[9] + ":" +
|
||||
dateStr[10] + dateStr[11];
|
||||
dateStr[10] + dateStr[11] + ":" +
|
||||
dateStr[12] + dateStr[13];
|
||||
}
|
||||
|
||||
export default ParseX509Certificate;
|
||||
|
|
Loading…
Reference in a new issue