/// <summary> /// Downloads the document that was uploaded before and signed offline. /// </summary> /// <remarks> /// The session is closed when the downloads finishes, it can't be reused afterward and should be removed from the storage. /// </remarks> /// <param name="session">The session linked to the uploaded document</param> /// <returns>The document with signature, including id and mimeType</returns> /// <exception cref="ArgumentException">When the signResponse isn't valid, including its signature</exception> /// <exception cref="InvalidOperationException">When the e-contract service returns an error</exception> public Document DownloadDocument(Dssp2StepSession session) { if (session == null) { throw new ArgumentNullException("session"); } var client = CreateDSSPClient(); var downloadRequest = CreateDownloadRequest(session); SignResponse downloadResponse = client.sign(downloadRequest); return(ProcessResponseWithSignedDoc(downloadResponse)); }
/// <summary> /// Downloads the document that was uploaded before and signed offline. /// </summary> /// <see cref="DownloadDocument(Dssp2StepSession)"/> public async Task <Document> DownloadDocumentAsync(Dssp2StepSession session) { if (session == null) { throw new ArgumentNullException("session"); } var client = CreateDSSPClient(); var downloadRequest = CreateDownloadRequest(session); signResponse1 downloadResponse = await client.signAsync(downloadRequest); return(ProcessResponseWithSignedDoc(downloadResponse.SignResponse)); }
private SignRequest CreateDownloadRequest(Dssp2StepSession session) { return(new SignRequest() { Profile = "http://docs.oasis-open.org/dss-x/ns/localsig", OptionalInputs = new OptionalInputs() { SignatureType = SignatureType, ServicePolicy = "http://docs.oasis-open.org/dss-x/ns/localsig/two-step-approach", CorrelationID = session.CorrelationId, SignatureObject = new SignatureObject() { Base64Signature = new Base64Signature() { Value = session.SignValue } } } }); }