コード例 #1
0
        public static Signing.DocuSignWeb.Recipient AddIDLookupToRecipient(Signing.DocuSignWeb.Recipient r, string address1, string address2, string city, string state, string zip)
        {
            r.RequireIDLookup = true;
            r.IDCheckConfigurationName = "ID Check $";
            if (address1 != null && city != null && state != null && zip != null)
            {

                r.IDCheckInformationInput = new Signing.DocuSignWeb.IDCheckInformationInput();
                r.IDCheckInformationInput.AddressInformationInput = new Signing.DocuSignWeb.AddressInformationInput();
                r.IDCheckInformationInput.AddressInformationInput.DisplayLevel = Signing.DocuSignWeb.DisplayLevelCode.Editable;
                r.IDCheckInformationInput.AddressInformationInput.DisplayLevelSpecified = true;
                r.IDCheckInformationInput.AddressInformationInput.ReceiveInResponse = true;
                r.IDCheckInformationInput.AddressInformationInput.ReceiveInResponseSpecified = true;
                r.IDCheckInformationInput.AddressInformationInput.AddressInformation = new Signing.DocuSignWeb.AddressInformation();
                r.IDCheckInformationInput.AddressInformationInput.AddressInformation.Street1 = address1;
                if (address2 != null)
                {
                    r.IDCheckInformationInput.AddressInformationInput.AddressInformation.Street2 = address2;
                }
                r.IDCheckInformationInput.AddressInformationInput.AddressInformation.City = city;
                r.IDCheckInformationInput.AddressInformationInput.AddressInformation.State = state;
                r.IDCheckInformationInput.AddressInformationInput.AddressInformation.Zip = zip;
            }
            return r;
        }
コード例 #2
0
        /// <summary>
        /// Generates a unique signature for this module.
        /// </summary>
        /// <param name="privateKey">The private key that only the developer of this module should know.</param>
        /// <returns>Returns whether or not the signature of the module was successfully generated.</returns>
        public bool GenerateSignature(byte[] privateKey)
        {
            this.PublicKey = Signing.GetPublicKey(privateKey);
            this.Signature = Signing.GenerateSignature(this.CompiledCode, privateKey);

            return(this.Signature != null);
        }
コード例 #3
0
        public void CombinatorialTest_PDF_Practicable(
            [Values(Signing.SigningEnabled, Signing.SigningDisabled)] Signing signing,
            [Values(Background.BackgroundEnabled, Background.BackgroundDisabled)] Background background,
            [Values(Encryption.EncryptionEnabled, Encryption.EncryptionDisabled)] Encryption encryption,
            [Values(EncryptionLevel.Rc40Bit, EncryptionLevel.Aes128Bit, EncryptionLevel.Aes128Bit, EncryptionLevel.Aes256Bit)] EncryptionLevel encryptionLevel,
            [Values(BasicPermissions.AllowBasicPermissions, BasicPermissions.DenyBasicPermissions)] BasicPermissions basicPermissions,
            [Values(ExtendedPermissions.AllowExtededPermissions, ExtendedPermissions.DenyExtededPermissions)] ExtendedPermissions extendedPermissions
            )
        {
            _th.Profile.PdfSettings.Signature.Enabled = signing == Signing.SigningEnabled;

            _th.Profile.BackgroundPage.Enabled = background == Background.BackgroundEnabled;

            _th.Profile.PdfSettings.Security.Enabled         = encryption == Encryption.EncryptionEnabled;
            _th.Profile.PdfSettings.Security.EncryptionLevel = encryptionLevel;

            _th.Profile.PdfSettings.Security.AllowToCopyContent     = basicPermissions == BasicPermissions.AllowBasicPermissions;
            _th.Profile.PdfSettings.Security.AllowToEditTheDocument = basicPermissions == BasicPermissions.AllowBasicPermissions;
            _th.Profile.PdfSettings.Security.AllowPrinting          = basicPermissions == BasicPermissions.AllowBasicPermissions;
            _th.Profile.PdfSettings.Security.AllowToEditComments    = basicPermissions == BasicPermissions.AllowBasicPermissions;

            _th.Profile.PdfSettings.Security.RestrictPrintingToLowQuality = extendedPermissions == ExtendedPermissions.AllowExtededPermissions;
            _th.Profile.PdfSettings.Security.AllowToFillForms             = extendedPermissions == ExtendedPermissions.AllowExtededPermissions;
            _th.Profile.PdfSettings.Security.AllowScreenReader            = extendedPermissions == ExtendedPermissions.AllowExtededPermissions;
            _th.Profile.PdfSettings.Security.AllowToEditAssembly          = extendedPermissions == ExtendedPermissions.AllowExtededPermissions;

            _th.GenerateGsJob(PSfiles.ThreePDFCreatorTestpages, OutputFormat.Pdf);
            _th.Job.Passwords.PdfSignaturePassword = TestCertPw;
            _th.RunGsJob();

            DoAllTests();
        }
コード例 #4
0
        public bool Save()
        {
            if (string.IsNullOrEmpty(SavePath))
            {
                return(false);
            }

            PList plist = new PList();

            plist.Root.Add(TYPE_KEY, TYPE_VALUE);
            plist.Root.Add(VERSION_KEY, VERSION);
            plist.Root.Add(BUILD_PLATFORM_KEY, Platform.ToString());
            plist.Root.Add(INFO_PLIST_KEY, InfoPlistChanges);
            plist.Root.Add(APP_CONFIG_KEY, AppConfig);
            plist.Root.Add(APP_CONFIG_ENABLED_KEY, AppConfigEnabled);
            plist.Root.Add(MANUAL_ENTITLEMENTS, ManualEntitlements);
            plist.Root.Add(FRAMEWORKS_KEY, Frameworks.Serialize());
            plist.Root.Add(FILES_AND_FOLDERS_KEY, FilesAndFolders.Serialize());
            plist.Root.Add(BUILD_SETTINGS_KEY, BuildSettings.Serialize());
            plist.Root.Add(SIGNING_KEY, Signing.Serialize());
            plist.Root.Add(SCRIPTS_KEY, Scripts.Serialize());


            plist.Root.Add(CAPABILITIES_KEY, Capabilities.Serialize());
            bool saved = plist.Save(SavePath, true);

            if (saved)
            {
                IsDirty = false;
            }

            return(saved);
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ReplyHandling"/> class.
 /// </summary>
 public ReplyHandling()
 {
     ReplyPattern    = ReplyPattern.Response;
     ReceiptHandling = new ReceiveReceiptHandling();
     ErrorHandling   = new ReceiveErrorHandling();
     ResponseSigning = new Signing();
 }
コード例 #6
0
        public void TestSigning()
        {
            // we can sign any hash, so for convenience we will sign the first
            // address of our test seed
            // (but remove the checksum) with the key of our fifth address
            var hashToSign     = FIRST_ADDR.RemoveChecksum();
            var signing        = new Signing(null);
            var key            = signing.Key(Converter.ToTrits(TEST_SEED), 5, 2);
            var normalizedHash = new Bundle().NormalizedBundle(hashToSign);

            var subKey            = new int[6561];
            var subNormalizedHash = new int[27];

            Array.Copy(key, 0, subKey, 0, 6561);
            Array.Copy(normalizedHash, 0, subNormalizedHash, 0, 27);
            var signature = signing.SignatureFragment(
                subNormalizedHash,
                subKey);

            Assert.AreEqual(SIGNATURE1, Converter.ToTrytes(signature));

            Array.Copy(key, 6561, subKey, 0, 6561);
            Array.Copy(normalizedHash, 27, subNormalizedHash, 0, 27);
            var signature2 = signing.SignatureFragment(
                subNormalizedHash,
                subKey);

            Assert.AreEqual(SIGNATURE2, Converter.ToTrytes(signature2));
        }
コード例 #7
0
 public ServerUploader(VectorDescription vectorDescription, CommandHandler cmd)
 {
     try
     {
         if (cmd != null)
         {
             cmd.EventFired += SendEvent;
         }
         var duplicates = vectorDescription._items.GroupBy(x => x.Descriptor).Where(x => x.Count() > 1).Select(x => x.Key);
         if (duplicates.Any())
         {
             throw new Exception("Title of datapoint in vector was listed twice: " + string.Join(", ", duplicates));
         }
         var loopName = IOconfFile.GetLoopName();
         _signing = new Signing(loopName);
         vectorDescription.IOconf = IOconfFile.RawFile;
         _vectorDescription       = vectorDescription;
         _plot = PlotConnection.Establish(loopName, _signing.GetPublicKey(), GetSignedVectorDescription(vectorDescription)).GetAwaiter().GetResult();
         new Thread(() => this.LoopForever()).Start();
         _cmd = cmd;
         cmd?.AddCommand("escape", Stop);
     }
     catch (Exception ex)
     {
         OnError("failed initializing uploader", ex);
         throw;
     }
 }
コード例 #8
0
        private X509Certificate2 RetrieveCertificate(Signing signInfo)
        {
            if (signInfo.SigningCertificateInformation == null)
            {
                throw new ConfigurationErrorsException(
                          "No signing certificate information found in PMode to perform signing. "
                          + "Please provide either a <CertificateFindCriteria/> or <PrivateKeyCertificate/> tag to the Security.Signing element");
            }

            if (signInfo.SigningCertificateInformation is CertificateFindCriteria certFindCriteria)
            {
                return(_repository.GetCertificate(
                           findType: certFindCriteria.CertificateFindType,
                           privateKeyReference: certFindCriteria.CertificateFindValue));
            }

            if (signInfo.SigningCertificateInformation is PrivateKeyCertificate embeddedCertInfo)
            {
                return(new X509Certificate2(
                           rawData: Convert.FromBase64String(embeddedCertInfo.Certificate),
                           password: embeddedCertInfo.Password,
                           keyStorageFlags:
                           X509KeyStorageFlags.Exportable
                           | X509KeyStorageFlags.MachineKeySet
                           | X509KeyStorageFlags.PersistKeySet));
            }

            throw new NotSupportedException(
                      "The signing certificate information specified in the PMode could not be used to retrieve the certificate. " +
                      "Please provide either a <CertificateFindCriteria/> or <PrivateKeyCertificate/> tag to the Security.Signing element");
        }
コード例 #9
0
ファイル: DoorController.cs プロジェクト: sanxchen/MntApp
        public ActionResult Index()
        {
            IEnumerable <SelectListItem> formSigns = new Signing().GetSignDataList(base.EmpNo).Where(k => k.Form.FormId == 16).ToList().Select(c => new SelectListItem()
            {
                Text  = c.Form.BaseEmployee.RealName,
                Value = c.Form.CreateEmpNo
            });

            formSigns = formSigns.Distinct(new PropertyComparer <SelectListItem>("Value"));

            ViewBag.UserList = formSigns;


            //---------------------------
            //BaseServices<Form> formService = new BaseServices<Form>();

            //IEnumerable<SelectListItem> forms = formService.LoadEntities(c => c.FormId == 16 && c.FormStatus == (int)Carlzhu.Iooin.Entity.FORM.Form.StatusEnum.签核中)
            //    .Distinct(new PropertyComparer<Form>("CreateEmpNo"))
            //    .Select(c => new SelectListItem()
            //    {
            //        Text = c.BaseEmployee.RealName,
            //        Value = c.CreateEmpNo
            //    });
            //ViewBag.UserList = forms;



            return(View());
        }
コード例 #10
0
        public object Post(
            [FromBody] Usuario usuario,
            [FromServices] Signing signingConfigurations,
            [FromServices] Token tokenConfigurations)
        {
            bool credenciaisValidas = false;

            if (usuario != null && usuario.ID != 0)
            {
                var usuarioBase = _usuarioRepository.Find(usuario.ID);
                credenciaisValidas = (usuarioBase != null &&
                                      usuario.Login == usuarioBase.Login &&
                                      usuario.Password == usuarioBase.Password);
            }

            if (credenciaisValidas)
            {
                ClaimsIdentity identity = new ClaimsIdentity(
                    new GenericIdentity(usuario.Login, "Login"),
                    new[] {
                    new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString("N")),
                    new Claim(JwtRegisteredClaimNames.UniqueName, usuario.Login)
                }
                    );

                DateTime dataCriacao   = DateTime.Now;
                DateTime dataExpiracao = dataCriacao +
                                         TimeSpan.FromSeconds(tokenConfigurations.Seconds);

                var handler       = new JwtSecurityTokenHandler();
                var securityToken = handler.CreateToken(new SecurityTokenDescriptor
                {
                    Issuer             = tokenConfigurations.Issuer,
                    Audience           = tokenConfigurations.Audience,
                    SigningCredentials = signingConfigurations.SigningCredentials,
                    Subject            = identity,
                    NotBefore          = dataCriacao,
                    Expires            = dataExpiracao
                });
                var token = handler.WriteToken(securityToken);

                return(new
                {
                    authenticated = true,
                    created = dataCriacao.ToString("yyyy-MM-dd HH:mm:ss"),
                    expiration = dataExpiracao.ToString("yyyy-MM-dd HH:mm:ss"),
                    accessToken = token,
                    message = "OK"
                });
            }
            else
            {
                return(new
                {
                    authenticated = false,
                    message = "Erro ao autenticar"
                });
            }
        }
コード例 #11
0
        bool LoadFile(string pathToFile)
        {
            if (!File.Exists(pathToFile))
            {
                Debug.LogError("EgoXproject: Change file does not exist: " + pathToFile);
                return(false);
            }

            SavePath = pathToFile;
            PList p = new PList();

            if (!p.Load(SavePath))
            {
                return(false);
            }

            if (!Validate(p))
            {
                return(false);
            }

            //set the platform. if non specified will default to ios
            BuildPlatform platform;

            if (p.Root.EnumValue(BUILD_PLATFORM_KEY, out platform))
            {
                Platform = platform;
            }
            else
            {
                Platform = BuildPlatform.iOS;
            }

            //reset everything
            Frameworks.Clear();
            FilesAndFolders.Clear();
            BuildSettings.Clear();
            Scripts.Clear();
            Signing.Clear();
            Capabilities.Clear();
            //load everything
            InfoPlistChanges = p.Root.DictionaryValue(INFO_PLIST_KEY).Copy() as PListDictionary;
            AppConfig        = p.Root.DictionaryValue(APP_CONFIG_KEY) != null?p.Root.DictionaryValue(APP_CONFIG_KEY).Copy() as PListDictionary : new PListDictionary();

            AppConfigEnabled = p.Root.ArrayValue(APP_CONFIG_ENABLED_KEY) != null?p.Root.ArrayValue(APP_CONFIG_ENABLED_KEY).Copy() as PListArray : new PListArray();

            ManualEntitlements = p.Root.DictionaryValue(MANUAL_ENTITLEMENTS) != null?p.Root.DictionaryValue(MANUAL_ENTITLEMENTS).Copy() as PListDictionary : new PListDictionary();

            LoadFrameworks(p.Root.DictionaryValue(FRAMEWORKS_KEY));
            LoadFilesAndFolders(p.Root.DictionaryValue(FILES_AND_FOLDERS_KEY));
            LoadScripts(p.Root.ArrayValue(SCRIPTS_KEY));
            LoadBuildSettings(p.Root.ArrayValue(BUILD_SETTINGS_KEY));
            LoadSigning(p.Root.DictionaryValue(SIGNING_KEY));
            LoadCapabilities(p.Root.DictionaryValue(CAPABILITIES_KEY));


            IsDirty = false;
            return(true);
        }
コード例 #12
0
ファイル: Startup.cs プロジェクト: fernandoweb/AppUsuario
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddTransient <IDbUsuarioRepository, dbUsuarioRepository>();



            var signingConfigurations = new Signing();

            services.AddSingleton(signingConfigurations);

            var token = new Token();

            new ConfigureFromConfigurationOptions <Token>(
                Configuration.GetSection("TokenConfig"))
            .Configure(token);
            services.AddSingleton(token);

            services.AddAuthentication(authOptions =>
            {
                authOptions.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
                authOptions.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
            }).AddJwtBearer(bearerOptions =>
            {
                var paramsValidation = bearerOptions.TokenValidationParameters;
                paramsValidation.IssuerSigningKey = signingConfigurations.Key;
                paramsValidation.ValidAudience    = token.Audience;
                paramsValidation.ValidIssuer      = token.Issuer;

                // Valida a assinatura de um token recebido
                paramsValidation.ValidateIssuerSigningKey = true;

                // Verifica se um token recebido ainda é válido
                paramsValidation.ValidateLifetime = true;

                // Tempo de tolerância para a expiração de um token (utilizado
                // caso haja problemas de sincronismo de horário entre diferentes
                // computadores envolvidos no processo de comunicação)
                paramsValidation.ClockSkew = TimeSpan.Zero;
            });

            // Ativa o uso do token como forma de autorizar o acesso
            // a recursos deste projeto
            services.AddAuthorization(auth =>
            {
                auth.AddPolicy("Bearer", new AuthorizationPolicyBuilder()
                               .AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme)
                               .RequireAuthenticatedUser().Build());
            });


            // Contexto Db
            services.AddDbContext <dbUsuarioContext>(opt =>
                                                     opt.UseSqlServer(Configuration.GetConnectionString("dbUsuario")));

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
            services.AddMvc();
        }
コード例 #13
0
ファイル: AbnormalController.cs プロジェクト: sanxchen/MntApp
        public ActionResult SavePart(FormNcrPart part, string abnormalImage, string abnormalAttribution)
        {
            if (!string.IsNullOrEmpty(abnormalImage) || !string.IsNullOrEmpty(abnormalAttribution))
            {
                var upNcrMain = new BaseServices <FormNcr>();
                //保存描述
                var ncrMain = upNcrMain.Single(c => c.FormNo == part.ParentFormNo);
                ncrMain.AbnormalImage       = abnormalImage;
                ncrMain.AbnormalAttribution = abnormalAttribution;
                upNcrMain.UpdateEntity(ncrMain);
            }


            //return Content("111");
            string empNo = ManageProvider.Provider.Current().UserId;
            Dictionary <string, object> dictionary = Request.Form.Cast <object>().ToDictionary <object, string, object>(para => para.ToString(), para => Request.Form[para.ToString()]);

            var formId    = int.Parse(dictionary["formid"].ToString());
            var employees = new Applying().GetSignListByFormId(dictionary, formId, empNo);
            var form      = new Form
            {
                FormNo      = new Applying().CreateFormNo(new object()),
                FormId      = formId,
                CreateEmpNo = empNo,
                CreateTime  = DateTime.Now,
                SignPath    = string.Join(",", employees.Select(c => c.EmpNo)) + ",",
                FormStatus  = 0,
                IsEmergents = true,
            };



            FormNcrPart partA = new FormNcrPart()
            {
                Mark = part.Mark, ReplyType = formId, ParentFormNo = part.ParentFormNo, Reviewer = empNo, ReviewTime = DateTime.Now
            };
            var result = new F <FormNcrPart>().SaveData(new List <FormNcrPart>()
            {
                partA
            }, form);


            //送签
            if (!result)
            {
                return(Link.ErrorBy(new Exception("数据更新失败,请检查填写是否完整"), this.GetType()));
            }
            new Applying().Send(form.FormNo, empNo);


            var daiqian = new BaseServices <FormSign>().LoadEntities(c => c.FormNo == form.FormNo).Last();
            var signed  = new Signing().Agree(daiqian.FormNo, daiqian.RowId, daiqian.SignEmpNo);

            Console.Write(signed);

            return(Content("success"));
        }
コード例 #14
0
        /// <summary>
        /// Sign the <see cref="AS4Message" />
        /// </summary>
        /// <param name="messagingContext"></param>
        /// <returns></returns>
        public async Task <StepResult> ExecuteAsync(MessagingContext messagingContext)
        {
            if (messagingContext == null)
            {
                throw new ArgumentNullException(nameof(messagingContext));
            }

            if (messagingContext.AS4Message == null)
            {
                throw new InvalidOperationException(
                          $"{nameof(SignAS4MessageStep)} requires an AS4Message to sign but no AS4Message is present in the MessagingContext");
            }

            if (messagingContext.AS4Message.IsEmpty)
            {
                Logger.Debug("No signing will be performed on the message because it's empty");
                return(await StepResult.SuccessAsync(messagingContext));
            }

            Signing signInfo = RetrieveSigningInformation(
                messagingContext.AS4Message,
                messagingContext.SendingPMode,
                messagingContext.ReceivingPMode);

            if (signInfo == null)
            {
                Logger.Trace("No signing will be performend on the message because no signing information was found in either Sending or Receiving PMode");
                return(await StepResult.SuccessAsync(messagingContext));
            }

            if (signInfo.IsEnabled == false)
            {
                Logger.Trace("No signing will be performend on the message because the PMode siging information is disabled");
                return(await StepResult.SuccessAsync(messagingContext));
            }

            Logger.Info($"(Outbound)[{messagingContext.AS4Message.GetPrimaryMessageId()}] Sign AS4Message with given signing information of the PMode");

            X509Certificate2 certificate = RetrieveCertificate(signInfo);
            var settings =
                new CalculateSignatureConfig(
                    signingCertificate: certificate,
                    referenceTokenType: signInfo.KeyReferenceMethod,
                    signingAlgorithm: signInfo.Algorithm,
                    hashFunction: signInfo.HashFunction);

            SignAS4Message(settings, messagingContext.AS4Message);

            JournalLogEntry logEntry = JournalLogEntry.CreateFrom(
                messagingContext.AS4Message,
                $"Signed with certificate {settings.SigningCertificate.FriendlyName} and reference {settings.ReferenceTokenType} "
                + $"using algorithm {settings.SigningAlgorithm} and hash {settings.HashFunction}");

            return(await StepResult
                   .Success(messagingContext)
                   .WithJournalAsync(logEntry));
        }
コード例 #15
0
        public void AddOne_NoCrash()
        {
            var chat     = new Chat();
            var signing1 = new Signing("Me :D", true, false);
            var signing2 = new Signing("Me :D", false, true);

            target.AddSigning(chat, signing1);
            target.AddSigning(chat, signing2);
        }
コード例 #16
0
        public void Threes_Proper_Processed()
        {
            var data = BuildMessageData("/sign 3");

            var expected = new Signing(data.Username, false, true);

            target.ProcessCommand(data);
            _mainController.Received().AddSigning(data.Chat, expected);
        }
コード例 #17
0
        public void TestVerifying()
        {
            var signing = new Signing(null);

            Assert.IsTrue(signing.ValidateSignatures(
                              RemoveChecksum(SIXTH_ADDR),
                              new[] { SIGNATURE1, SIGNATURE2 },
                              RemoveChecksum(FIRST_ADDR)));
        }
コード例 #18
0
        public void GenerateMultipleAddressesInParrell()
        {
            var signing = new Signing(new Crypto.Kerl());

            System.Threading.Tasks.Parallel.For(0, 99, (i) =>
            {
                signing.GenerateAddress(ADDR_SEED, i);
                // IotaUtils.GenerateAddress(ADDR_SEED, i);
            });
        }
コード例 #19
0
 public bool HasChanges()
 {
     return(InfoPlistChanges.Count > 0 ||
            Frameworks.HasChanges() ||
            FilesAndFolders.HasChanges() ||
            BuildSettings.HasChanges() ||
            Scripts.HasChanges() ||
            Signing.HasChanges() ||
            Capabilities.HasChanges());
 }
コード例 #20
0
ファイル: PDFPreprocessor.cs プロジェクト: zsy960/PDFCreator
        /*
         * private ActionResult EncyptAndSignPdfFile(string sourceFilename, IJob job)
         * {
         *  string tmp = Path.GetTempFileName();
         *  ActionResult result = SignPdfFile(sourceFilename, tmp, job);
         *
         *  if (result.Success)
         *  {
         *      try
         *      {
         *          File.Copy(tmp, sourceFilename, true);
         *          File.Delete(tmp);
         *          Logger.Trace(sourceFilename + " encrypted and/or signed!");
         *      }
         *      catch
         *      {
         *          Logger.Error("Could not copy encrypted and/or signed file from tmp to " + sourceFilename);
         *          return new ActionResult(ActionId, 108);
         *      }
         *  }
         *  else
         *      Logger.Error("Failed to encrypt and/or sign " + sourceFilename);
         *
         *  return result;
         * }
         */

        public ActionResult CheckEncryptAndSignSettings(ConversionProfile profile)
        {
            var actionResult = new ActionResult();

            Signing sign = profile.PdfSettings.Signing;

            if (sign.Enable)
            {
                if (string.IsNullOrEmpty(sign.CertificationFile))
                {
                    Logger.Error("Error in signing. Missing certification file.");
                    actionResult.Add(ActionId, 100);
                }
                else if (File.Exists(sign.CertificationFile) == false)
                {
                    Logger.Error("Error in signing. The certification file '" + sign.CertificationFile +
                                 "' doesn't exist.");
                    actionResult.Add(ActionId, 101);
                }

                if (profile.AutoSave.Enable)
                {
                    if (string.IsNullOrEmpty(sign.SignaturePassword))
                    {
                        Logger.Error("Automatic saving without certificate password.");
                        actionResult.Add(ActionId, 109);
                    }
                }
            }

            Security security = profile.PdfSettings.Security;

            if (security.Enable)
            {
                if (profile.AutoSave.Enable)
                {
                    if (string.IsNullOrEmpty(security.OwnerPassword))
                    {
                        Logger.Error("No saved owner password for security in automatic saving.");
                        actionResult.Add(ActionId, 110);
                    }

                    if (security.RequireUserPassword)
                    {
                        if (string.IsNullOrEmpty(security.UserPassword))
                        {
                            Logger.Error("No saved user password for security in automatic saving.");
                            actionResult.Add(ActionId, 111);
                        }
                    }
                }
            }

            return(actionResult);
        }
コード例 #21
0
        public void TwosFull()
        {
            var state    = new ChatState();
            var signing1 = new Signing("First", true);
            var signing2 = new Signing("Second", true);

            state = state.AddSigning(signing1).AddSigning(signing2);

            state.TwosFull().ShouldBe(true);
            state.ThreesFull().ShouldBe(false);
        }
コード例 #22
0
        public Tx SignTransaction(UnsignedTx unsignedTx, string privateKey)
        {
            byte[] networkData  = System.Text.Encoding.UTF8.GetBytes(Configuration.Network);
            byte[] binaryTx     = Encoding.DecodeCheckWithIdentifier(unsignedTx.TX);
            byte[] txAndNetwork = networkData.Concatenate(binaryTx);
            byte[] sig          = Signing.Sign(txAndNetwork, privateKey);
            Tx     tx           = new Tx();

            tx.TX = Encoding.EncodeSignedTransaction(sig, binaryTx);
            return(tx);
        }
コード例 #23
0
        public void TestKeyLength()
        {
            var signing = new Signing(null);
            var key     = signing.Key(Converter.ToTrits(TEST_SEED), 5, 1);

            Assert.AreEqual(Signing.KeyLength, key.Length);
            key = signing.Key(Converter.ToTrits(TEST_SEED), 5, 2);
            Assert.AreEqual(2 * Signing.KeyLength, key.Length);
            key = signing.Key(Converter.ToTrits(TEST_SEED), 5, 3);
            Assert.AreEqual(3 * Signing.KeyLength, key.Length);
        }
コード例 #24
0
        public void TestKeyLength()
        {
            Signing signing = new Signing();

            sbyte[] key = signing.Key(Converter.ToTrits(TEST_SEED), 5, 1);
            Assert.AreEqual(Constants.KEY_LENGTH, key.Length);
            key = signing.Key(Converter.ToTrits(TEST_SEED), 5, 2);
            Assert.AreEqual(2 * Constants.KEY_LENGTH, key.Length);
            key = signing.Key(Converter.ToTrits(TEST_SEED), 5, 3);
            Assert.AreEqual(3 * Constants.KEY_LENGTH, key.Length);
        }
コード例 #25
0
 public static AbstractBitFormat GetFormat(Format format, Signing signing)
 {
     if (format.Equals(Format.BYTE))
     {
         // return a signed or unsigned byte
         return(new ByteFormat());
     }
     else
     {
         return(null);
     }
 }
コード例 #26
0
        public void Pubdewell()
        {
            var datalist = new Signing().GetSignDataList("1504109").Take(1000);


            var query = new Quality();

            foreach (var formSign in datalist)
            {
                query.Published(formSign.FormNo, formSign.RowId, formSign.SignEmpNo, DateTime.Now, false);
            }
        }
コード例 #27
0
        public void StartTag()
        {
            var now  = Time.Now();
            var then = now.AddHours(2);

            var data = BuildMessageData("/sign 3 " + then.ToShortTimeString());

            var expected = new Signing(data.Username, false, true, then);

            target.ProcessCommand(data);
            _mainController.Received().AddSigning(data.Chat, expected);
        }
コード例 #28
0
        public void GenerateMultipleAddresses()
        {
            var stopwatch = System.Diagnostics.Stopwatch.StartNew();
            var signing   = new Signing(new Crypto.Kerl());

            for (int i = 0; i < 10; i++)
            {
                signing.GenerateAddress(ADDR_SEED, i);
                //IotaUtils.GenerateAddress(ADDR_SEED, i);
            }
            Console.WriteLine(stopwatch.Elapsed);
        }
コード例 #29
0
ファイル: Page.cs プロジェクト: gageorsburn/BlazeSoft.Net.Web
        public bool GenerateSignature(byte[] privateKey)
        {
            this.PublicKey = Signing.GetPublicKey(privateKey);

            if (this.CompiledCode == null)
            {
                throw new Exception("Compiled code is null for page: " + this.ID);
            }

            this.Signature = Signing.GenerateSignature(this.CompiledCode, privateKey);
            return(this.Signature != null);
        }
コード例 #30
0
        public void FillParty_Twos()
        {
            var chat     = new Chat();
            var signing1 = new Signing("First", true, false);
            var signing2 = new Signing("Second", true, false);

            var expected = new ChatState(
                ImmutableList.Create(signing1, signing2));

            target.AddSigning(chat, signing1);
            target.AddSigning(chat, signing2).ShouldBe(expected);
        }
コード例 #31
0
 public bool HasChanges()
 {
     return(AppConfigEnabled.Count > 0 ||
            InfoPlistChanges.Count > 0 ||
            ManualEntitlements.Count > 0 ||
            Frameworks.HasChanges() ||
            FilesAndFolders.HasChanges() ||
            BuildSettings.HasChanges() ||
            Scripts.HasChanges() ||
            Signing.HasChanges() ||
            Capabilities.HasChanges());
 }
コード例 #32
0
        public static Signing.DocuSignWeb.Recipient AddPhoneAuthToRecipient(Signing.DocuSignWeb.Recipient r, string phoneNumber)
        {
            r.RequireIDLookup = true;
            r.IDCheckConfigurationName = "Phone Auth $";
            r.PhoneAuthentication = new Signing.DocuSignWeb.RecipientPhoneAuthentication();
            r.PhoneAuthentication.RecipMayProvideNumber = true;
            r.PhoneAuthentication.RecipMayProvideNumberSpecified = true;
            r.PhoneAuthentication.RecordVoicePrint = true;
            r.PhoneAuthentication.RecordVoicePrintSpecified = true;
            r.PhoneAuthentication.SenderProvidedNumbers = new string[1];
            r.PhoneAuthentication.SenderProvidedNumbers[0] = phoneNumber;

            return r;
        }
コード例 #33
0
 public static LinkedTab CreateTab(Signing.DocuSignWeb.Recipient recipient,
     string name, string value,
     string anchorString, int XOffset, int YOffset)
 {
     LinkedTab tab = new LinkedTab();
     tab.Recipient = recipient;
     tab.Tab.Type = Signing.DocuSignWeb.TabTypeCode.Custom;
     tab.Tab.Name = name;
     tab.Tab.TabLabel = name;
     tab.Tab.Value = value;
     tab.Tab.AnchorTabItem = new DocuSignWeb.AnchorTab();
     tab.Tab.AnchorTabItem.XOffset = XOffset;
     tab.Tab.AnchorTabItem.YOffset = YOffset;
     tab.Tab.AnchorTabItem.AnchorTabString = anchorString;
     return tab;
 }
コード例 #34
0
 /// <summary>
 /// A shortcut function to create a fully functional anchor tab
 /// </summary>
 /// <returns>A linked tab which has a fully qualified anchor tab item</returns>
 public static LinkedTab CreateTab(
     Signing.DocuSignWeb.TabTypeCode tabType,
     Signing.DocuSignWeb.Recipient recipient,
     string anchorString, int XOffset, int YOffset)
 {
     Debug.Assert(tabType != DocuSignWeb.TabTypeCode.Custom, "A wrong helper function is used" +
             " custom tabs should not be created with CreateStandardTab");
     LinkedTab tab = new LinkedTab();
     tab.Recipient = recipient;
     tab.Tab.Type = tabType;
     tab.Tab.AnchorTabItem = new DocuSignWeb.AnchorTab();
     tab.Tab.AnchorTabItem.XOffset = XOffset;
     tab.Tab.AnchorTabItem.YOffset = YOffset;
     tab.Tab.AnchorTabItem.AnchorTabString = anchorString;
     return tab;
 }