小编Das*_*Das的帖子

如何通过提供PrivateKey来获取RSA PublicKey?

我正在寻找一个Java函数,它将获得一个RSA PrivateKey并将返回正确的RSA PublicKey?

或者,是否有一个函数可以告诉我们RSA PrivateKey/PublicKey是否有效?

java security cryptography rsa

11
推荐指数
3
解决办法
1万
查看次数

Web API和HTTP模块

我们有一个HTTP模块可以解码所有编码请求.它适用于所有WCF请求,但不适用于Web Api请求 - 在Web Api中请求(POST和GET)到达仍然编码的服务

我看到它点击了HTTP模块,但是,仍然可以获得编码的服务.我该如何解决?或者我做错了什么?我知道在Web Api中使用消息处理程序更好,但是HTTP模块假设也可以工作 - 不是吗?

HTTP模块:

public void Init(HttpApplication context)
    {
        context.BeginRequest += new EventHandler(context_BeginRequest);
        context.EndRequest += context_PreSendRequestContent;
    }

    void context_PreSendRequestContent(object sender, EventArgs e)
    {
        string encodedQuerystring = HttpContext.Current.Request.QueryString.ToString();
        if (!string.IsNullOrEmpty(encodedQuerystring))
        {
            System.Collections.Specialized.NameValueCollection col = new System.Collections.Specialized.NameValueCollection();
            col.Add("q", encodedQuerystring);
            WebFunction.CreateQuerystring(HttpContext.Current, col);
        }


    }

    void context_BeginRequest(object sender, EventArgs e)
    {
        string encodedQueryString = String.Empty;
        if (HttpContext.Current.Request.QueryString.Count > 0 && HttpContext.Current.Request.QueryString["q"] != null)
        {

            object _p = HttpContext.Current.Request.QueryString;
            encodedQueryString = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["q"].ToString());

            string originalQueryString = HttpContext.Current.Server.UrlDecode(WebFunction.Base64Decode(encodedQueryString));

            if …
Run Code Online (Sandbox Code Playgroud)

c# asp.net wcf asp.net-web-api asp.net-web-api2

11
推荐指数
1
解决办法
3035
查看次数

WPF-验证错误事件不会触发

我想我已经阅读了所有相关文章,但没有帮助..

我试图启用/禁用datagrid错误状态的保存按钮 - 但没有成功.

这是我的代码:

承包商:

AddHandler(Validation.ErrorEvent, new RoutedEventHandler(OnErrorEvent));
Run Code Online (Sandbox Code Playgroud)

XAML:

    <Page
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
 xmlns:local="clr-namespace:Metsuka_APP" x:Class="Metsuka_APP.MichlolimManagment" 
  mc:Ignorable="d" 
  d:DesignHeight="500" d:DesignWidth="500"
Title="MichlolimManagment"
x:Name="Michlolim_Managment" Validation.Error="Michlolim_Managment_Error">
<Page.Resources>

<DataGrid x:Name="AGAFIMDataGrid" VerticalAlignment="Center" RowEditEnding="rowEditEnding" Margin="10" FlowDirection="RightToLeft" Height="340"
    AutoGenerateColumns="False" EnableRowVirtualization="True"
                  ItemsSource="{Binding Source={StaticResource aGAFIMViewSource}}"   Grid.Row="1"
                  RowDetailsVisibilityMode="VisibleWhenSelected"
                 ScrollViewer.CanContentScroll="True"
                 ScrollViewer.VerticalScrollBarVisibility="Auto" 
                 HorizontalGridLinesBrush="Silver"
                 VerticalGridLinesBrush="Silver">
            <DataGrid.Resources>
                <Style x:Key="errorStyle" TargetType="{x:Type TextBox}">
                    <Setter Property="Padding" Value="-2"/>
                    <Style.Triggers>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter Property="Background" Value="Red"/>
                            <Setter Property="ToolTip" 
          Value="{Binding RelativeSource={RelativeSource Self},
            Path=(Validation.Errors)[0].ErrorContent}"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.Resources>
            <DataGrid.Columns>
                <DataGridTextColumn x:Name="agaf_nameColumn"  Header="name" Width="*">
                    <DataGridTextColumn.Binding>
                        <Binding Path="agaf_name" NotifyOnValidationError="True" > …
Run Code Online (Sandbox Code Playgroud)

c# validation wpf error-handling events

10
推荐指数
1
解决办法
5884
查看次数

Java - 使用regex-failure从字符串中提取日期

我正在尝试使用正则表达式从字符串中提取2个日期 - 由于某种原因 - 正则表达式不提取日期 - 这是我的代码:

private  String[] getDate(String desc) {
    int count=0;
    String[] allMatches = new String[2];
    Matcher m = Pattern.compile("(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\\d\\d(?:,)").matcher(desc);
    while (m.find()) {
        allMatches[count] = m.group();
    }
    return allMatches;
}
Run Code Online (Sandbox Code Playgroud)

我的字符串desc是:"coming from the 11/25/2009 to the 11/30/2009" 我得到一个空数组...

java regex date

9
推荐指数
3
解决办法
2万
查看次数

WPF- MessageBox是最顶层的

我有一个WPF应用程序,我需要MessageBox始终是最顶级的.在胜利形式我会做这样的事情:

System.Windows.Forms.MessageBox.Show(new Form() { TopMost = true }, "sure you wanna save?", "confirm", MessageBoxButtons.YesNo)
Run Code Online (Sandbox Code Playgroud)

但是我如何在WPF中做到这一点?

我看到了几个不同的答案,但不是它们对我有用,例如:

MessageBox.Show(Application.Current.MainWindow, "Im always on top - of the main window");
Run Code Online (Sandbox Code Playgroud)

mainWindo是空的.在我的应用程序中,它MessageBox是从不同的页面打开 - 而不是窗口

知道我是怎么用最简单的方式做到的吗?

c# wpf

0
推荐指数
3
解决办法
2652
查看次数