mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-04-15 06:56:44 +00:00
Take only first cert in multi part PEM (#916)
* Take only first cert in multi part PEM, minimize side effects * Other cases * Github Actions dropping their ubuntu 20 runner
This commit is contained in:
parent
436b0482c4
commit
d9dafb0526
@ -13,7 +13,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2022
|
||||
- os: ubuntu-20.04
|
||||
- os: ubuntu-22.04
|
||||
# - os: windows-2019 Cannot Target windows-2019 because the .NET 6 SDK won't receive security patches for this image
|
||||
steps:
|
||||
- name: Set git to use LF
|
||||
|
@ -58,9 +58,15 @@ public final class CredentialHelper {
|
||||
public static byte[] stripPemHeaderFooter(final String pemFile) {
|
||||
String strippedFile;
|
||||
strippedFile = pemFile.replace(CertificateVariables.PEM_HEADER, "");
|
||||
strippedFile = strippedFile.replace(CertificateVariables.PEM_FOOTER, "");
|
||||
int keyFooterPos = strippedFile.indexOf(CertificateVariables.PEM_FOOTER);
|
||||
if (keyFooterPos >= 0) {
|
||||
strippedFile = strippedFile.substring(0, keyFooterPos);
|
||||
}
|
||||
strippedFile = strippedFile.replace(CertificateVariables.PEM_ATTRIBUTE_HEADER, "");
|
||||
strippedFile = strippedFile.replace(CertificateVariables.PEM_ATTRIBUTE_FOOTER, "");
|
||||
int attrFooterPos = strippedFile.indexOf(CertificateVariables.PEM_ATTRIBUTE_FOOTER);
|
||||
if (attrFooterPos >= 0) {
|
||||
strippedFile = strippedFile.substring(0, attrFooterPos);
|
||||
}
|
||||
return Base64.decode(strippedFile);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user