fix(pki): strip HTML comments from PEM blocks before parsing
Some upstream keybox sources inject HTML comments inside PEM certificate blocks. BouncyCastle's PEMParser chokes on these non-base64 lines, silently failing to load the keybox. Filter lines starting with <!-- in trimLines() before the content reaches the PEM parser.
This commit is contained in:
@@ -6,7 +6,11 @@ package org.matrix.TEESimulator.util
|
||||
*
|
||||
* @return A new string with each line individually trimmed.
|
||||
*/
|
||||
fun String.trimLines(): String = this.trim().lines().joinToString("\n") { it.trim() }
|
||||
fun String.trimLines(): String =
|
||||
this.trim()
|
||||
.lines()
|
||||
.filter { !it.trim().startsWith("<!--") }
|
||||
.joinToString("\n") { it.trim() }
|
||||
|
||||
/**
|
||||
* Converts a ByteArray to its hexadecimal string representation.
|
||||
|
||||
Reference in New Issue
Block a user