Skip to content

Commit e663e59

Browse files
author
Elena Fiocca
committed
Code preparation for Release
1 parent 8edbc63 commit e663e59

File tree

13 files changed

+165
-723
lines changed

13 files changed

+165
-723
lines changed

AxisIPCamera/Client/AxisHttpClient.cs

Lines changed: 70 additions & 654 deletions
Large diffs are not rendered by default.

AxisIPCamera/Helpers/CertificateErrorContext.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using System.Collections.Generic;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using System.Collections.Generic;
29
using System.Linq;
310

411
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Helpers

AxisIPCamera/Helpers/DeviceCertValidator.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
1-
#nullable enable
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
#nullable enable
29
using System;
310
using System.Collections.Generic;
411
using System.IO;
512
using System.Linq;
613
using System.Net.Http;
714
using System.Net.Security;
8-
using System.Security;
915
using System.Security.Cryptography.X509Certificates;
10-
using System.Text.RegularExpressions;
11-
using Keyfactor.Logging;
1216
using Microsoft.Extensions.Logging;
17+
1318
using Org.BouncyCastle.Asn1.X509;
1419
using Org.BouncyCastle.X509;
1520
using Org.BouncyCastle.X509.Extension;
1621
using X509Certificate = Org.BouncyCastle.X509.X509Certificate;
1722

23+
using Keyfactor.Logging;
24+
1825
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Helpers
1926
{
2027
public static class DeviceCertValidator

AxisIPCamera/Helpers/PAMUtilities.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using Keyfactor.Orchestrators.Extensions.Interfaces;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using Keyfactor.Orchestrators.Extensions.Interfaces;
29
using Microsoft.Extensions.Logging;
310

411
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Helpers

AxisIPCamera/Inventory.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using System;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using System;
29
using System.Collections.Generic;
310
using System.Linq;
411

AxisIPCamera/Management.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
using System;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using System;
29
using System.Text;
310
using System.Linq;
4-
using System.Collections.Generic;
511
using System.Security.Cryptography.X509Certificates;
6-
using Keyfactor.Logging;
7-
using Keyfactor.Orchestrators.Extensions;
8-
using Keyfactor.Orchestrators.Common.Enums;
9-
1012
using Microsoft.Extensions.Logging;
11-
1213
using Newtonsoft.Json;
1314

15+
using Keyfactor.Logging;
16+
using Keyfactor.Orchestrators.Extensions;
17+
using Keyfactor.Orchestrators.Common.Enums;
1418
using Keyfactor.Extensions.Orchestrator.AxisIPCamera.Client;
1519
using Keyfactor.Extensions.Orchestrator.AxisIPCamera.Model;
1620
using Keyfactor.Orchestrators.Extensions.Interfaces;
@@ -133,7 +137,6 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
133137
}
134138

135139
// Build PEM content
136-
// TODO: Add this and the logic in reenrollment to client class (consolidate)
137140
string formattedDer = InsertLineBreaks(certBase64Der, 64);
138141
_logger.LogDebug(($"Formatted certificate contents:\n{formattedDer}"));
139142

@@ -192,14 +195,6 @@ public JobResult ProcessJob(ManagementJobConfiguration config)
192195

193196
break;
194197
}
195-
case CertStoreOperationType.Create:
196-
//OperationType == Create - Create an empty certificate store in the provided location
197-
//Code logic to:
198-
// 1) Connect to the orchestrated server (config.CertificateStoreDetails.ClientMachine) where the certificate store (config.CertificateStoreDetails.StorePath) will be located
199-
// 2) Custom logic to first check if the store already exists and add it if not. If it already exists, implementation dependent as to how to handle - error, warning, success
200-
// TODO: This is not supported operation
201-
202-
break;
203198
default:
204199
//Invalid OperationType. Return error. Should never happen though
205200
return new JobResult() { Result = Keyfactor.Orchestrators.Common.Enums.OrchestratorJobStatusJobResult.Failure, JobHistoryId = config.JobHistoryId, FailureMessage = $"Site {config.CertificateStoreDetails.StorePath} on server {config.CertificateStoreDetails.ClientMachine}: Unsupported operation: {config.OperationType.ToString()}" };

AxisIPCamera/Model/ApiResponse.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using Newtonsoft.Json;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using Newtonsoft.Json;
29

310
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Model
411
{

AxisIPCamera/Model/Certificate.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
using System.Collections.Generic;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using System.Collections.Generic;
29
using Newtonsoft.Json;
310

411
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Model

AxisIPCamera/Model/Constants.cs

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
using System;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
8+
using System;
29
using System.IO;
3-
using System.Security.Cryptography.X509Certificates;
4-
using System.Text;
510
using Org.BouncyCastle.OpenSsl;
611
using Org.BouncyCastle.Pkcs;
7-
using Org.BouncyCastle.Crypto;
812

913
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Model
1014
{
@@ -208,32 +212,5 @@ public static void ValidateCsr(string csrPem)
208212
throw new Exception($"CSR Validation failed: {ex.Message}");
209213
}
210214
}
211-
212-
public static void ValidateCertificate(X509Certificate2 cert)
213-
{
214-
var errors = new StringBuilder();
215-
216-
try
217-
{
218-
using (var chain = new X509Chain())
219-
{
220-
bool isValid = chain.Build(cert);
221-
222-
if (!isValid)
223-
{
224-
foreach (var status in chain.ChainStatus)
225-
{
226-
errors.AppendLine($"Chain error: {status.Status} - {status.StatusInformation}");
227-
}
228-
229-
throw new Exception(errors.ToString());
230-
}
231-
}
232-
}
233-
catch (Exception ex)
234-
{
235-
throw new Exception($"Certificate Validation failed: \n{ex.Message}");
236-
}
237-
}
238215
}
239216
}

AxisIPCamera/Model/Keystore.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
using System.Collections.Generic;
1+
// Copyright 2025 Keyfactor
2+
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
3+
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
5+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
6+
// and limitations under the License.
7+
28
using Newtonsoft.Json;
39

410
namespace Keyfactor.Extensions.Orchestrator.AxisIPCamera.Model

0 commit comments

Comments
 (0)