Пример #1
0
        public override void ImportParameters(DSAParameters parameters)
        {
            DSACspObject @object = DSACryptoServiceProvider.DSAStructToObject(parameters);

            if (this._safeKeyHandle != null && !this._safeKeyHandle.IsClosed)
            {
                this._safeKeyHandle.Dispose();
            }
            this._safeKeyHandle = SafeKeyHandle.InvalidHandle;
            if (DSACryptoServiceProvider.IsPublic(parameters))
            {
                Utils._ImportKey(Utils.StaticDssProvHandle, 8704, CspProviderFlags.NoFlags, (object)@object, ref this._safeKeyHandle);
            }
            else
            {
                KeyContainerPermission            containerPermission = new KeyContainerPermission(KeyContainerPermissionFlags.NoFlags);
                KeyContainerPermissionAccessEntry accessEntry         = new KeyContainerPermissionAccessEntry(this._parameters, KeyContainerPermissionFlags.Import);
                containerPermission.AccessEntries.Add(accessEntry);
                containerPermission.Demand();
                if (this._safeProvHandle == null)
                {
                    this._safeProvHandle = Utils.CreateProvHandle(this._parameters, this._randomKeyContainer);
                }
                Utils._ImportKey(this._safeProvHandle, 8704, this._parameters.Flags, (object)@object, ref this._safeKeyHandle);
            }
        }