mirror of
https://github.com/gchq/CyberChef
synced 2024-11-15 00:57:08 +00: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}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function formatDate (dateStr) {
|
function formatDate (dateStr) {
|
||||||
return dateStr[4] + dateStr[5] + "/" +
|
if (dateStr.length === 13) { // UTC Time
|
||||||
dateStr[2] + dateStr[3] + "/" +
|
if (dateStr[0] < "5") {
|
||||||
(dateStr[0] < "5" ? "20" : "19") +
|
dateStr = "20" + dateStr;
|
||||||
dateStr[0] + dateStr[1] + " " +
|
} else {
|
||||||
dateStr[6] + dateStr[7] + ":" +
|
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[8] + dateStr[9] + ":" +
|
||||||
dateStr[10] + dateStr[11];
|
dateStr[10] + dateStr[11] + ":" +
|
||||||
|
dateStr[12] + dateStr[13];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ParseX509Certificate;
|
export default ParseX509Certificate;
|
||||||
|
|
Loading…
Reference in a new issue