mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
* Saving attestation certificate to file * Updates to provisioner certificate generation
This commit is contained in:
parent
7037429f06
commit
ca0646d946
@ -14,6 +14,9 @@ namespace hirs {
|
|||||||
private Settings settings = null;
|
private Settings settings = null;
|
||||||
private IHirsDeviceInfoCollector deviceInfoCollector = null;
|
private IHirsDeviceInfoCollector deviceInfoCollector = null;
|
||||||
private IHirsAcaClient acaClient = null;
|
private IHirsAcaClient acaClient = null;
|
||||||
|
|
||||||
|
private const string DefaultCertFileName = "attestationkey.pem";
|
||||||
|
|
||||||
|
|
||||||
public Provisioner() {
|
public Provisioner() {
|
||||||
}
|
}
|
||||||
@ -279,6 +282,20 @@ namespace hirs {
|
|||||||
}
|
}
|
||||||
if (cr.HasCertificate) {
|
if (cr.HasCertificate) {
|
||||||
certificate = cr.Certificate.ToByteArray(); // contains certificate
|
certificate = cr.Certificate.ToByteArray(); // contains certificate
|
||||||
|
String certificateDirPath = settings.efi_prefix;
|
||||||
|
if (certificateDirPath != null) {
|
||||||
|
String certificateFilePath = certificateFilePath = certificateDirPath + DefaultCertFileName;
|
||||||
|
try {
|
||||||
|
if (!Directory.Exists(certificateDirPath)) {
|
||||||
|
Directory.CreateDirectory(certificateDirPath);
|
||||||
|
}
|
||||||
|
File.WriteAllBytes(certificateFilePath, certificate);
|
||||||
|
Log.Debug("Certificate written to local file system: ", certificateFilePath);
|
||||||
|
}
|
||||||
|
catch (Exception) {
|
||||||
|
Log.Debug("Failed to write certificate to local file system.");
|
||||||
|
}
|
||||||
|
}
|
||||||
Log.Debug("Printing attestation key certificate: " + BitConverter.ToString(certificate));
|
Log.Debug("Printing attestation key certificate: " + BitConverter.ToString(certificate));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user