From dcb85e126dc2b7321ab9fd9d0b9d141171ebaaa2 Mon Sep 17 00:00:00 2001 From: Dave Galey Date: Tue, 30 Nov 2021 13:47:26 -0500 Subject: [PATCH] update packages --- GoDaddy/API/APIProcessor.cs | 2 +- GoDaddy/GoDaddy.csproj | 100 ++++++++++++++++++++++++++++++------ GoDaddy/GoDaddyCAProxy.cs | 2 +- GoDaddy/app.config | 16 +++++- GoDaddy/packages.config | 31 ++++++++--- Release Notes.txt | 3 ++ 6 files changed, 127 insertions(+), 27 deletions(-) diff --git a/GoDaddy/API/APIProcessor.cs b/GoDaddy/API/APIProcessor.cs index 5d6ebd9..1258212 100644 --- a/GoDaddy/API/APIProcessor.cs +++ b/GoDaddy/API/APIProcessor.cs @@ -13,7 +13,7 @@ // limitations under the License. using CSS.Common.Logging; -using CSS.PKI; +using Keyfactor.PKI; using Keyfactor.AnyGateway.GoDaddy.Models; using Newtonsoft.Json; using RestSharp; diff --git a/GoDaddy/GoDaddy.csproj b/GoDaddy/GoDaddy.csproj index 01fd264..217fe47 100644 --- a/GoDaddy/GoDaddy.csproj +++ b/GoDaddy/GoDaddy.csproj @@ -9,7 +9,7 @@ Properties CAProxy.Generic.GoDaddy GoDaddyCAProxy - v4.6.2 + v4.7.2 512 true @@ -32,14 +32,17 @@ 4 - - ..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll + + ..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll - - ..\packages\Keyfactor.AnyGateway.SDK.20.9.0\lib\net462\CAProxy.AnyGateway.Core.dll + + ..\packages\Keyfactor.AnyGateway.SDK.21.3.2\lib\net462\CAProxy.AnyGateway.Core.dll - - ..\packages\Keyfactor.AnyGateway.SDK.20.9.0\lib\net462\CAProxy.Interfaces.dll + + ..\packages\Keyfactor.AnyGateway.SDK.21.3.2\lib\net462\CAProxy.Interfaces.dll + + + ..\packages\Keyfactor.AnyGateway.SDK.21.3.2\lib\net462\CAProxyDAL.dll ..\packages\Common.Logging.3.4.1\lib\net40\Common.Logging.dll @@ -47,27 +50,91 @@ ..\packages\Common.Logging.Core.3.4.1\lib\net40\Common.Logging.Core.dll - - ..\packages\Keyfactor.AnyGateway.SDK.20.9.0\lib\net462\CommonCAProxy.dll + + ..\packages\Keyfactor.AnyGateway.SDK.21.3.2\lib\net462\CommonCAProxy.dll - - ..\packages\CSS.Common.1.6.0\lib\net462\CSS.Common.dll + + ..\packages\CSS.Common.1.7.0\lib\net462\CSS.Common.dll - - ..\packages\CSS.PKI.2.11.0\lib\net462\CSS.PKI.dll + + ..\packages\CSS.PKI.2.13.0\lib\net462\CSS.PKI.dll - ..\packages\CERTENROLLLibx64.1.0.0.1\lib\net35\Interop.CERTENROLLLib.dll + ..\packages\CERTENROLLLibx64.1.0.0.2\lib\net35\Interop.CERTENROLLLib.dll True + + ..\packages\Keyfactor.Logging.1.1.0\lib\netstandard2.0\Keyfactor.Logging.dll + + + ..\packages\Keyfactor.PKI.4.0.1\lib\net472\Keyfactor.PKI.dll + + + ..\packages\Microsoft.Extensions.Logging.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll + + + ..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll - - ..\packages\RestSharp.106.11.7\lib\net452\RestSharp.dll + + ..\packages\RestSharp.106.13.0\lib\net452\RestSharp.dll + + + + ..\packages\System.Configuration.ConfigurationManager.5.0.0\lib\net461\System.Configuration.ConfigurationManager.dll + + + + + + ..\packages\System.IO.4.3.0\lib\net462\System.IO.dll + True + True + + + + ..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll + True + True + + + + ..\packages\System.Security.AccessControl.5.0.0\lib\net461\System.Security.AccessControl.dll + + + ..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll + True + True + + + ..\packages\System.Security.Cryptography.Cng.5.0.0\lib\net47\System.Security.Cryptography.Cng.dll + + + ..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll + True + True + + + ..\packages\System.Security.Cryptography.Pkcs.5.0.1\lib\net461\System.Security.Cryptography.Pkcs.dll + + + ..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll + True + True + + + ..\packages\System.Security.Permissions.5.0.0\lib\net461\System.Security.Permissions.dll + + + ..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll + + + @@ -75,6 +142,7 @@ + diff --git a/GoDaddy/GoDaddyCAProxy.cs b/GoDaddy/GoDaddyCAProxy.cs index ab807dd..7e7912b 100644 --- a/GoDaddy/GoDaddyCAProxy.cs +++ b/GoDaddy/GoDaddyCAProxy.cs @@ -1,4 +1,4 @@ -// Copyright 2021 Keyfactor // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using CAProxy.AnyGateway.Interfaces; using CAProxy.AnyGateway.Models; using CAProxy.Common; using CSS.Common; using CSS.Common.Logging; using CSS.PKI; using CSS.PKI.PEM; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using Keyfactor.AnyGateway.GoDaddy.API; using Keyfactor.AnyGateway.GoDaddy.Models; namespace Keyfactor.AnyGateway.GoDaddy { public class GoDaddyCAProxy : CAProxy.AnyGateway.BaseCAConnector { private APIProcessor _api { get; set; } private string _rootType { get; set; } private int _syncPageSize { get; set; } private int _enrollmentRetries { get; set; } private int _secondsBetweenEnrollmentRetries { get; set; } private string[][] _connectionKeys = new string[][] { new string[] { "ApiUrl", "string" }, new string[] { "ApiKey", "string" }, new string[] { "ShopperId", "string" }, new string[] { "RootType", "string" }, new string[] { "SyncPageSize", "int" }, new string[] { "EnrollmentRetries", "int" }, new string[] { "SecondsBetweenEnrollmentRetries", "int" } }; #region Interface Methods public override void Initialize(ICAConnectorConfigProvider configProvider) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); foreach (KeyValuePair configEntry in configProvider.CAConnectionData) Logger.Trace($"{configEntry.Key}: {configEntry.Value}"); ValidateParameters(configProvider.CAConnectionData, _connectionKeys); string apiUrl = configProvider.CAConnectionData["ApiUrl"].ToString(); string apiKey = configProvider.CAConnectionData["ApiKey"].ToString(); string shopperId = configProvider.CAConnectionData["ShopperId"].ToString(); _rootType = configProvider.CAConnectionData["RootType"].ToString(); _syncPageSize = Convert.ToInt32(configProvider.CAConnectionData["SyncPageSize"]); _enrollmentRetries = Convert.ToInt32(configProvider.CAConnectionData["EnrollmentRetries"]); _secondsBetweenEnrollmentRetries = Convert.ToInt32(configProvider.CAConnectionData["SecondsBetweenEnrollmentRetries"]); _api = new APIProcessor(apiUrl, apiKey, shopperId); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } public override void Ping() { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } public override void ValidateCAConnectionInfo(Dictionary connectionInfo) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); ValidateParameters(connectionInfo, _connectionKeys); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } [Obsolete] public override void Synchronize(ICertificateDataReader certificateDataReader, BlockingCollection blockingBuffer, CertificateAuthoritySyncInfo certificateAuthoritySyncInfo, CancellationToken cancelToken, string logicalName) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); throw new NotImplementedException(); } public override void Synchronize(ICertificateDataReader certificateDataReader, BlockingCollection blockingBuffer, CertificateAuthoritySyncInfo certificateAuthoritySyncInfo, CancellationToken cancelToken) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); string customerId = JsonConvert.DeserializeObject(_api.GetCustomerId()).customerId; int pageNumber = 1; bool wasLastPage = false; do { GETCertificatesDetailsResponse certificates = JsonConvert.DeserializeObject(_api.GetCertificates(customerId, pageNumber, _syncPageSize)); foreach (CertificateDetails certificate in certificates.certificates) { Thread.Sleep(1000); try { string issuedCert = RemovePEMHeader(JsonConvert.DeserializeObject(_api.DownloadCertificate(certificate.certificateId)).pems.certificate); CertificateStatusEnum certStatus = CertificateStatusEnum.ISSUED; if (!Enum.TryParse(certificate.status, out certStatus)) certStatus = CertificateStatusEnum.CANCELED; blockingBuffer.Add(new CAConnectorCertificate { CARequestID = certificate.certificateId, Certificate = issuedCert, CSR = string.Empty, ResolutionDate = certificate.completedAt, RevocationDate = certificate.revokedAt, RevocationReason = null, Status = APIProcessor.MapReturnStatus(certStatus), SubmissionDate = certificate.createdAt, ProductID = certificate.type }); } catch (GoDaddyException) { } } wasLastPage = certificates.pagination.previous == certificates.pagination.last; pageNumber++; } while (!wasLastPage); blockingBuffer.CompleteAdding(); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } [Obsolete] public override EnrollmentResult Enroll(string csr, string subject, Dictionary san, EnrollmentProductInfo productInfo, PKIConstants.X509.RequestFormat requestFormat, RequestUtilities.EnrollmentType enrollmentType) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); throw new NotImplementedException(); } public override EnrollmentResult Enroll(ICertificateDataReader certificateDataReader, string csr, string subject, Dictionary san, EnrollmentProductInfo productInfo, PKIConstants.X509.RequestFormat requestFormat, RequestUtilities.EnrollmentType enrollmentType) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); foreach (KeyValuePair configEntry in productInfo.ProductParameters) Logger.Trace($"{configEntry.Key}: {configEntry.Value}"); +// Copyright 2021 Keyfactor // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using CAProxy.AnyGateway.Interfaces; using CAProxy.AnyGateway.Models; using CAProxy.Common; using CSS.Common; using CSS.Common.Logging; using Keyfactor.PKI; using Keyfactor.PKI.PEM; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Newtonsoft.Json; using Keyfactor.AnyGateway.GoDaddy.API; using Keyfactor.AnyGateway.GoDaddy.Models; namespace Keyfactor.AnyGateway.GoDaddy { public class GoDaddyCAProxy : CAProxy.AnyGateway.BaseCAConnector { private APIProcessor _api { get; set; } private string _rootType { get; set; } private int _syncPageSize { get; set; } private int _enrollmentRetries { get; set; } private int _secondsBetweenEnrollmentRetries { get; set; } private string[][] _connectionKeys = new string[][] { new string[] { "ApiUrl", "string" }, new string[] { "ApiKey", "string" }, new string[] { "ShopperId", "string" }, new string[] { "RootType", "string" }, new string[] { "SyncPageSize", "int" }, new string[] { "EnrollmentRetries", "int" }, new string[] { "SecondsBetweenEnrollmentRetries", "int" } }; #region Interface Methods public override void Initialize(ICAConnectorConfigProvider configProvider) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); foreach (KeyValuePair configEntry in configProvider.CAConnectionData) Logger.Trace($"{configEntry.Key}: {configEntry.Value}"); ValidateParameters(configProvider.CAConnectionData, _connectionKeys); string apiUrl = configProvider.CAConnectionData["ApiUrl"].ToString(); string apiKey = configProvider.CAConnectionData["ApiKey"].ToString(); string shopperId = configProvider.CAConnectionData["ShopperId"].ToString(); _rootType = configProvider.CAConnectionData["RootType"].ToString(); _syncPageSize = Convert.ToInt32(configProvider.CAConnectionData["SyncPageSize"]); _enrollmentRetries = Convert.ToInt32(configProvider.CAConnectionData["EnrollmentRetries"]); _secondsBetweenEnrollmentRetries = Convert.ToInt32(configProvider.CAConnectionData["SecondsBetweenEnrollmentRetries"]); _api = new APIProcessor(apiUrl, apiKey, shopperId); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } public override void Ping() { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } public override void ValidateCAConnectionInfo(Dictionary connectionInfo) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); ValidateParameters(connectionInfo, _connectionKeys); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } [Obsolete] public override void Synchronize(ICertificateDataReader certificateDataReader, BlockingCollection blockingBuffer, CertificateAuthoritySyncInfo certificateAuthoritySyncInfo, CancellationToken cancelToken, string logicalName) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); throw new NotImplementedException(); } public override void Synchronize(ICertificateDataReader certificateDataReader, BlockingCollection blockingBuffer, CertificateAuthoritySyncInfo certificateAuthoritySyncInfo, CancellationToken cancelToken) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); string customerId = JsonConvert.DeserializeObject(_api.GetCustomerId()).customerId; int pageNumber = 1; bool wasLastPage = false; do { GETCertificatesDetailsResponse certificates = JsonConvert.DeserializeObject(_api.GetCertificates(customerId, pageNumber, _syncPageSize)); foreach (CertificateDetails certificate in certificates.certificates) { Thread.Sleep(1000); try { string issuedCert = RemovePEMHeader(JsonConvert.DeserializeObject(_api.DownloadCertificate(certificate.certificateId)).pems.certificate); CertificateStatusEnum certStatus = CertificateStatusEnum.ISSUED; if (!Enum.TryParse(certificate.status, out certStatus)) certStatus = CertificateStatusEnum.CANCELED; blockingBuffer.Add(new CAConnectorCertificate { CARequestID = certificate.certificateId, Certificate = issuedCert, CSR = string.Empty, ResolutionDate = certificate.completedAt, RevocationDate = certificate.revokedAt, RevocationReason = null, Status = APIProcessor.MapReturnStatus(certStatus), SubmissionDate = certificate.createdAt, ProductID = certificate.type }); } catch (GoDaddyException) { } } wasLastPage = certificates.pagination.previous == certificates.pagination.last; pageNumber++; } while (!wasLastPage); blockingBuffer.CompleteAdding(); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); } [Obsolete] public override EnrollmentResult Enroll(string csr, string subject, Dictionary san, EnrollmentProductInfo productInfo, CSS.PKI.PKIConstants.X509.RequestFormat requestFormat, RequestUtilities.EnrollmentType enrollmentType) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); Logger.MethodExit(ILogExtensions.MethodLogLevel.Debug); throw new NotImplementedException(); } public override EnrollmentResult Enroll(ICertificateDataReader certificateDataReader, string csr, string subject, Dictionary san, EnrollmentProductInfo productInfo, CSS.PKI.PKIConstants.X509.RequestFormat requestFormat, RequestUtilities.EnrollmentType enrollmentType) { Logger.MethodEntry(ILogExtensions.MethodLogLevel.Debug); foreach (KeyValuePair configEntry in productInfo.ProductParameters) Logger.Trace($"{configEntry.Key}: {configEntry.Value}"); string[][] parameterKeys = new string[][] { }; if (enrollmentType == RequestUtilities.EnrollmentType.New) parameterKeys = new string[][] { new string[] { "Email", "string" }, new string[] { "FirstName", "string" }, new string[] { "LastName", "string" }, new string[] { "Phone", "string" }, new string[] { "CertificatePeriodInYears", "int" } }; else diff --git a/GoDaddy/app.config b/GoDaddy/app.config index a0e49aa..b221ec0 100644 --- a/GoDaddy/app.config +++ b/GoDaddy/app.config @@ -19,8 +19,20 @@ limitations under the License. - + + + + + + + + + + + + + - + diff --git a/GoDaddy/packages.config b/GoDaddy/packages.config index ac8d0dd..5841d6d 100644 --- a/GoDaddy/packages.config +++ b/GoDaddy/packages.config @@ -15,14 +15,31 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + + - - - - + + + + + + + + - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Release Notes.txt b/Release Notes.txt index 5555ed7..8fe55e6 100644 --- a/Release Notes.txt +++ b/Release Notes.txt @@ -1,3 +1,6 @@ +v1.0.4 +- Update nuget packages + v1.0.3 - Code cleanup, publish to github.