Exemplo n.º 1
0
        public Tuple<SignatureResponseStatus, string> GetSignatureResponse(Certificate certificate)
        {
            Begin();
              Status.VotingClient.GetSignatureResponse(certificate.Id, GetSignatureResponseComplete);

              if (WaitForCompletion())
              {
            switch (this.responseStatus)
            {
              case SignatureResponseStatus.Accepted:
              case SignatureResponseStatus.Declined:
            var response = this.signatureResponse.Value;

            if (response.SubjectId.Equals(certificate.Id) &&
              this.signatureResponse.Verify(Status.CertificateStorage))
            {
              if (this.responseStatus == SignatureResponseStatus.Accepted)
              {
                certificate.AddSignature(response.Signature);
                certificate.Save(this.certificates[certificate]);
              }

              return new Tuple<SignatureResponseStatus, string>(this.responseStatus, response.Reason);
            }
            else
            {
              return new Tuple<SignatureResponseStatus, string>(SignatureResponseStatus.Unknown, string.Empty);
            }
              default:
            return new Tuple<SignatureResponseStatus, string>(this.responseStatus, string.Empty);
            }
              }
              else
              {
            return new Tuple<SignatureResponseStatus, string>(SignatureResponseStatus.Unknown, string.Empty);
              }
        }
Exemplo n.º 2
0
 public void SaveCertificate(Certificate certificate)
 {
     if (this.certificates.ContainsKey(certificate))
       {
     certificate.Save(this.certificates[certificate]);
       }
       else
       {
     AddAndSaveCertificate(certificate);
       }
 }
Exemplo n.º 3
0
 public void AddAndSaveCertificate(Certificate certificate)
 {
     string certificateFileName = Path.Combine(Status.DataPath, certificate.Id.ToString() + Files.CertificateExtension);
       certificate.Save(certificateFileName);
       this.certificates.Add(certificate, certificateFileName);
 }