Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
N

ninodago

@ninodago
About
Posts
5
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Crypto in C#/4.0 using PKCS#10 and SHA256
    N ninodago

    I'm facing a new situation involving a program, written in .NET Framework 4.0/C#, which has to encode/decode and sign messages to be sent/received in a particular kind of WAN. This is the current scenario, which is working fine. We have a .p12 file (which contains the sender certificate) and a .cer file (which contains the receiver certificate), which are both installed in the pc. The scenario is working using SHA1 and PKCS#7 at 1024 bit, so the following piece of code works:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Security.Cryptography.X509Certificates;
    using System.Security.Cryptography.Pkcs;
    using System.Security.Cryptography;
    using System.Windows;
    using System.Windows.Controls;
    using System.Collections;
    private static string senderCert = "sendername"; //the name registered in .p12 file
    private static string receiverCert = "receivername"; //the name registered in .cer file
    /// ///verify that the receiving message is signed
    ///and returns the data without sign
    ///
    /// dataflow with sign
    ///
    public static byte[] Verify(this byte[] signedData)
    {
    X509Certificate2 certPub = GetReceiverCert();
    if (certPub == null) return null;

        ContentInfo decodeContentInfo = new ContentInfo(signedData);
        SignedCms decodeCMS = new SignedCms(decodeContentInfo, false);
    
        try
        {
            //decode the message, if it isn't signed, raise an exception
            decodeCMS.Decode(signedData);
            SignerInfo signerInfo = decodeCMS.SignerInfos\[0\];
    
            X509Certificate2Collection certCollection = new 
                        X509Certificate2Collection(certPub);                
            return decodeCMS.ContentInfo.Content;
        }
        catch (CryptographicException err)
        {
            Logger.Log(err);
            return null;
        }
    }
    
    /// /// Returns the certificate used to sign the sending messages
    /// 
    /// 
    private static X509Certificate2 GetSenderCert()
    {
        //Open the personal certificates folder
        X509Store storeMy = new X509Store(StoreName.My, StoreLocation.CurrentUser);
        storeMy.Open(OpenFlags.ReadOnly);
    
        //find the proper certificate
        X509Certificate2Collection certColl = storeMy.Certificates.Find 
        (X509FindType.
    
    C# csharp cryptography dotnet linq security

  • Handling Events inside a "while" clause
    N ninodago

    Thanks a lot, I made the changes and now the running is quite good! Bye Nino Look Torino 2006 - - - - - FORZA ITALIA!!!

    .NET (Core and Framework) csharp database dotnet visual-studio graphics

  • Handling Events inside a "while" clause
    N ninodago

    HumanOsc wrote:

    1.) You can use the SelectedIndex Property to check if an item is selected... if(listView.SelectedIndex == -1) return;

    I don't have the definition SelectedIndex inside ListView. ('System.Windows.Forms.ListView' does not contain a definition for 'SelectedIndex')... I use VS .Net 2003 with CF 1.0. I used this code, but I'm not sure if it has the same effect... if (listViewCatalogo.SelectedIndices[0] == -1) return; Another question. In which point of the program should I use this code? Inside the definition of listViewCatalogo_SelectedIndexChanged event? When I deploy I have the same errors. If I declare the control inside or outside the while clause I have this message: Error: index (I mean, the variable passed to the last testing form(FormProdotto).

    .NET (Core and Framework) csharp database dotnet visual-studio graphics

  • Handling Events inside a "while" clause
    N ninodago

    sorry, it was my first message and it was very important for me, I'll remember for the next time! thank you

    .NET (Core and Framework) csharp database dotnet visual-studio graphics

  • Handling Events inside a "while" clause
    N ninodago

    Hi to all. I have a problem with my thesis. I'm realizing an application with VS .Net 2003 for PDA in C#. I have a catalog stored into the PDA and I want to navigate into it. I've builded a database which consists of 4 important tables: three categories tables (First, Second and Third) and the "Products" table. I use a ListView object to navigate inside the categories. The code is this (I bolded the important part): using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data.SqlServerCe; using System.Data.SqlClient; using System.Data; using System.Reflection; using System.IO; namespace SmartDeviceApplication3 { /// /// Form per sfogliare il catalogo - Form to navigate inside the catalog /// public class FormSfogliaCatalogo : System.Windows.Forms.Form { private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.PictureBox pictureBox3; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pictureBox4; private System.Windows.Forms.MainMenu mainMenu1; private System.Windows.Forms.ListView listViewCatalogo; public FormSfogliaCatalogo() { // // Required for Windows Form Designer support // InitializeComponent(); listViewCatalogo.Activation = ItemActivation.OneClick; listViewCatalogo.View = System.Windows.Forms.View.SmallIcon; //Declare the connection variable SqlCeConnection sqlConn1 = new SqlCeConnection(); try { // Open a connection to the database sqlConn1.ConnectionString = "Data Source =\\My Documents\\db.sdf"; sqlConn1.Open(); SqlCeCommand searchCommand = new SqlCeCommand(); searchCommand.Connection = sqlConn1; searchCommand.CommandText = "SELECT * FROM TIPOLOGIA_PRIMARIA"; // it means select * from first category // Execute and return the rows in the data reader object SqlCeDataReader dR; dR = searchCommand.ExecuteReader(CommandBehavior.CloseConnection); int nFields = dR.FieldCount; // Setup the columns in the listview using the fields in the table listViewCatalogo.Clear(); listViewCatalogo.Columns.Add("Categoria", -1, HorizontalAlignment.Left); // Fill the rows in the l

    .NET (Core and Framework) csharp database dotnet visual-studio graphics
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups