示例#1
0
        public ICollection <FileModel> SignDocuments(ArubaSignModel signModel, IEnumerable <FileModel> documents, bool requiredMark)
        {
            ArubaSignModel signerModel = signModel;

            List <FileModel> results = new List <FileModel>();
            FileModel        signedFile;

            foreach (FileModel file in documents)
            {
                signedFile = new FileModel
                {
                    Filename = $"{file.Filename}.p7m",
                    Document = SignDocument(signModel, file.Document, file.Filename, requiredMark)
                };
                results.Add(signedFile);
            }
            return(results);
        }
示例#2
0
        public byte[] SignDocument(ArubaSignModel signModel, byte[] document, string filename, bool requiredMark)
        {
            _externalInfoLogger($"Aruba Sign Document request with document {document.Length}");
            ArubaSignModel signerModel = signModel;

            Aruba.signRequestV2 requestV2 = null;

            requestV2 = new Aruba.signRequestV2
            {
                certID   = signerModel.CertificateId,
                identity = new Aruba.auth()
                {
                    delegated_domain   = signerModel.DelegatedDomain,
                    delegated_password = signerModel.DelegatedPassword,
                    delegated_user     = signerModel.DelegatedUser,
                    otpPwd             = signerModel.OTPPassword,
                    typeOtpAuth        = signerModel.OTPAuthType,
                    user = signerModel.User,
                },
                tsa_identity = new Aruba.tsaAuth()
                {
                    user     = signerModel.TSAUser,
                    password = signerModel.TSAPassword
                },
                requiredmark = requiredMark,//per la marca temporale
                stream       = document,
                transport    = Aruba.typeTransport.STREAM,
            };

            return(RetryingPolicyAction(() =>
            {
                Aruba.signReturnV2 response = _arubaSignServiceClient.pkcs7signV2(requestV2, false, true);
                if (response.status == "OK")
                {
                    _externalInfoLogger($"Document has been successfully signed by ARUBA ARSS.");
                    return response.stream;
                }
                _externalInfoLogger($"ARUBA ARSS failed with status {response.status} > {response.description}");
                throw new Exception(response.description);
            }));
        }
示例#3
0
 public ICollection <FileModel> SignDocuments(ArubaSignModel signModel, IEnumerable <FileModel> documents, bool requiredMark)
 {
     return(InitializeFactory().SignDocuments(signModel, documents, requiredMark));
 }
示例#4
0
 public byte[] SignDocument(ArubaSignModel signModel, byte[] document, string filename, bool requiredMark)
 {
     return(InitializeFactory().SignDocument(signModel, document, filename, requiredMark));
 }