internal static DocumentBundle Create(Forsendelse forsendelse, GuidUtility guidUtility, X509Certificate2 senderCertificate, IAsiceConfiguration asiceConfiguration) { var manifest = new Manifest(forsendelse); ValidateXmlAndThrowIfInvalid(manifest.Xml(), "Manifest"); var signature = new Signature(forsendelse, manifest, senderCertificate); ValidateXmlAndThrowIfInvalid(signature.Xml(), "Signatur"); var asiceAttachables = new List<IAsiceAttachable>(); asiceAttachables.AddRange(forsendelse.Dokumentpakke.Vedlegg); asiceAttachables.Add(forsendelse.Dokumentpakke.Hoveddokument); asiceAttachables.Add(manifest); asiceAttachables.Add(signature); var asiceAttachableProcessors = ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(forsendelse, asiceConfiguration); var asiceArchive = new AsiceArchive(forsendelse.PostInfo.Mottaker.Sertifikat, guidUtility, asiceAttachableProcessors, asiceAttachables.ToArray()); return new DocumentBundle(asiceArchive.Bytes, asiceArchive.UnzippedContentBytesCount, asiceArchive.ContentId); }
public static DocumentBundle CreateAsice(Job job, X509Certificate2 certificate, IAsiceConfiguration asiceConfiguration) { var manifest = new Manifest(job.Sender, (Document)job.Document, job.Signers) { Availability = job.Availability, AuthenticationLevel = job.AuthenticationLevel, IdentifierInSignedDocuments = job.IdentifierInSignedDocuments }; var signature = new SignatureGenerator(certificate, job.Document, manifest); var asiceArchive = GetAsiceArchive(job, asiceConfiguration, job.Document, manifest, signature); return(new DocumentBundle(asiceArchive.GetBytes())); }
private static IEnumerable <AsiceAttachableProcessor> ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(Forsendelse forsendelseForMetadata, IAsiceConfiguration asiceConfiguration) { return(asiceConfiguration.Dokumentpakkeprosessorer.Select(p => new AsiceAttachableProcessor(forsendelseForMetadata, p))); }
internal static DocumentBundle Create(Forsendelse forsendelse, GuidUtility guidUtility, X509Certificate2 senderCertificate, IAsiceConfiguration asiceConfiguration) { var manifest = new Manifest(forsendelse); ValidateXmlAndThrowIfInvalid(manifest.Xml(), "Manifest"); var signature = new Signature(forsendelse, manifest, senderCertificate); ValidateXmlAndThrowIfInvalid(signature.Xml(), "Signatur"); var asiceAttachables = new List <IAsiceAttachable>(); asiceAttachables.AddRange(forsendelse.Dokumentpakke.Vedlegg); asiceAttachables.Add(forsendelse.Dokumentpakke.Hoveddokument); asiceAttachables.Add(manifest); asiceAttachables.Add(signature); var asiceAttachableProcessors = ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(forsendelse, asiceConfiguration); var asiceArchive = new AsiceArchive(forsendelse.PostInfo.Mottaker.Sertifikat, guidUtility, asiceAttachableProcessors, asiceAttachables.ToArray()); return(new DocumentBundle(asiceArchive.Bytes, asiceArchive.UnzippedContentBytesCount, asiceArchive.ContentId)); }
private static IEnumerable<AsiceAttachableProcessor> ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(Forsendelse forsendelseForMetadata, IAsiceConfiguration asiceConfiguration) { return asiceConfiguration.Dokumentpakkeprosessorer.Select(p => new AsiceAttachableProcessor(forsendelseForMetadata, p)); }