Exemplo n.º 1
0
        public async Task <CertificateRequestRecordApiModel> GetCertificateRequestAsync(string requestId)
        {
            var result = await _certificateRequest.ReadAsync(requestId);

            return(new CertificateRequestRecordApiModel(
                       requestId,
                       result.ApplicationId,
                       result.State,
                       result.CertificateGroupId,
                       result.CertificateTypeId,
                       result.SigningRequest,
                       result.SubjectName,
                       result.DomainNames,
                       result.PrivateKeyFormat));
        }
Exemplo n.º 2
0
        private async Task NewKeyPairRequestAllApplications()
        {
            Skip.If(!_fixture.RegistrationOk);
            int count = 0;

            foreach (var application in _applicationTestSet)
            {
                string[] groups = await _certificateGroup.GetCertificateGroupIds();

                foreach (var group in groups)
                {
                    var    applicationId = application.Model.ApplicationId.ToString();
                    string requestId     = await _certificateRequest.StartNewKeyPairRequestAsync(
                        applicationId,
                        group,
                        null,
                        application.Subject,
                        application.DomainNames.ToArray(),
                        application.PrivateKeyFormat,
                        application.PrivateKeyPassword,
                        "*****@*****.**");

                    Assert.NotNull(requestId);
                    // read request
                    var request = await _certificateRequest.ReadAsync(requestId);

                    Assert.Equal(CertificateRequestState.New, request.State);
                    Assert.Equal(requestId, request.RequestId);
                    Assert.Equal(applicationId, request.ApplicationId);
                    Assert.False(request.SigningRequest);
                    Assert.True(Opc.Ua.Utils.CompareDistinguishedName(application.Subject, request.SubjectName));
                    Assert.Equal(group, request.CertificateGroupId);
                    //Assert.Equal(null, fullRequest.CertificateTypeId);
                    Assert.Equal(application.DomainNames.ToArray(), request.DomainNames);
                    Assert.Equal(application.PrivateKeyFormat, request.PrivateKeyFormat);

                    // TODO: test all fields
                    application.RequestIds.Add(requestId);
                    count++;
                }
            }
            Assert.True(count > 0);
        }