コード例 #1
0
        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);
        }
コード例 #2
0
        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()));
        }
コード例 #3
0
 private static IEnumerable <AsiceAttachableProcessor> ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(Forsendelse forsendelseForMetadata, IAsiceConfiguration asiceConfiguration)
 {
     return(asiceConfiguration.Dokumentpakkeprosessorer.Select(p => new AsiceAttachableProcessor(forsendelseForMetadata, p)));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
 private static IEnumerable<AsiceAttachableProcessor> ConvertDocumentBundleProcessorsToAsiceAttachableProcessors(Forsendelse forsendelseForMetadata, IAsiceConfiguration asiceConfiguration)
 {
     return asiceConfiguration.Dokumentpakkeprosessorer.Select(p => new AsiceAttachableProcessor(forsendelseForMetadata, p));
 }