.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

RSA Private/Public key

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
I have an web application that encrypts data using a public and sent it to another web application. Which will then decrypt the data using a the user private key.My question is, since but the Private and Public key are generated in the first application. how does the other application get the private?Thanks!

View Complete Post

More Related Resource Links

How to Import a Public/Private key pair into RSA Key Container

Hi,I am trying to build a RSA decryption application with .NET(windows application). I have had my public / private keys used in existing applications, and want to reuse them. The question is how I can import them into a RSA Key Container (used in RSACryptoServiceProvider), or is there any other way that can re-use these keys?Thank you in advance,Junbin

public web methods...how to make private? Security question


I understand how to set security for a ASP.NET web page, how to encrypt a Silverlight page, and a WCF application, but my question goes to this:  given a web method, which by definition must be public, how do you keep people from accessing it outside of your client program?

If your program (client) is the only way to access this web method, then there's no problem.  But it is impossible to make a web method private--it won't compile--so how to keep people from using it?  The only thing I can think of is that if you call your web method by an obscure sounding name, it's likely nobody will guess the URL, and if you set your server so it cannot be searched (dir *.*) by the public, it's unlikely anybody will ever guess the name of the web method.  But this is hardly 100% secure.  And what if you call your web method "DoWork", which is the default OperationContract name in Visual Studio?

What am I missing?



//what I have in mind

public interface IService1
        string DoWork();


public string DoWork()
//secret stuff in here
string SecretStuff = "S

save reports in Private and Public folder using Report Builder 2.0




I have a report builder built on RB2.0. Users are able to create their reports and browse them.

Now, Users wants these reports to be saved in their Private folder and public folder.


Also, I have a UI developed in .Net 3.5 from where I am calling this report builder.  In the UI, I need to show the users those reports that they have created in a drop down list. And when the user clicks on any report (that they created should) open.


I have searched a lot but not getting any clue how to allow the business user to save a report

WCF returns private members of the object instead of returning the Public members



I am  using WCF to return a serialized custom object to a web page which access the WCF using a script manager. The problem here is the object returned all the private members instead of the public members although the private members are marked private.

The flow behind this: the asp.net  web site stores the object in SQL State session; all the classes in the object are marked serialized as it is stored in SQL State Session. All the public properties in the classes are marked as <DataMember>. When trying to access this object from the client it lists down all the private members of the class instead of listing the public members.

Please advice!

Many Thanks




Public Private Key Based Encryption


Hello Guys

I need to encrypt some info using my Public/Private key, and allow the other party(users) to ONLY DECRYPT what I encrypted. I don't want them to be able to know how I encrypted my message. How it is possible in .NET using public and private key pair?

I tried RSACryptoServiceProvider in .NET but the issue with that is

i) We can only encrypt using Public key and decrypt using Private key
ii) Private key xml string always contains public key xml string.

So if i use RSA than i have to distribute Private key along with public key to the users who needs to decrypt my message.

Can you please help how to over come above situation where i do not have to sent with which key i encrypted.

Please help



Matching C# methods with a pattern finding the Public, Private, etc modifiers and balancing the curl


Hello all,

For a large conversion project, we need to match certain key words within C# methods and remove the entire method if found. I know .Net has a feature that allows balanced matching on the curly braces, but I am not sure how to implement it.

In a two step process, you could match the modifiers Public, Private, etc and their balanced curly braces to identify the methods and then remove those that contained the key words. In a one step process, I think you could use a positive lookahead for the key words as well.

Could someone help me with the pattern that has the balanced curly brace logic with the modifiers to identify the methods? Thanks in advance for any ideas and/or suggestions.


Have a great day!

"Object contains only the public half of a key pair. A private key must also be provided." with 2 .p


Here's the code:

using ADPTest.com.adp.hrbws;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;
using Microsoft.Web.Services3.Security.Cryptography;

namespace ADPTest
    class Program
        static void Main(string[] args)
            // Create the web service proxy.
            HrbService proxy = new HrbService();

            // Add the Username token.
            UsernameToken usernameToken = new UsernameToken("user@ABC"," ");

            // Add the certificate for mutual SSL.
            X509Certificate2 mutualCert = new X509Certificate2 "I:\\auth.pem", "

Public Shared function doubt????

I am using VB.net/ASP.NET and SQL Server 2000 for a web application.

For populating the dropdowns, I wrote a Public Shared function LoadDDL(), in which I pass the dataset and dropdown name to set.

I have my doubts that this function will produce unexpected results for concurrent users. And will mix the results among sessions because it is a Shared function.

I am confused here. Is it the right way to go?

Please advice. Thanks in advance.


NUnit and public static readonly


I have an app that I am testing with NUNit.  The project im testing has several helper classes that are created as public static readonly.  When I run the NUnit tests, they all fail with the same error

SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.
SetUp : System.TypeInitializationException : The type initializer for 'Systems.Utils.ConstantHelpers' threw an exception.
  ----> System.NullReferenceException : Object reference not set to an instance of an object.

I kept getting this error despite stripping out all

Security: Protect Private Data with the Cryptography Namespaces of the .NET Framework


The .NET Framework includes a set of cryptographic services that extend the services provided by Windows through the Crypto API. In this article, the author explores the System.Security.Cryptography namespace and the programming model used to apply cryptographic transformations. He discusses reasons why cryptography is easier in .NET than it was before, including the easy programmatic acccess developers have to the cryptography APIs and the difference between symmetric and asymmetric algorithms. Along the way, a brief discussion of the most widely used algorithms, including RSA, DSA, Rijndael, SHA, and other hash algorithms, is provided.

Dan Fox

MSDN Magazine June 2002

Checkout/Chevk in issue in MOSS 2007 while connecting through VPN(virtual private network)


HI, I am using VPN connection . When I try modify a file and try to checkin the file in sharepoint document library it does not gets checked in. I get a message saying

"Unable to checkin the file, since File is being edited in Local Draft, please close the application or discard the checkout ".

Please do the needful....



public object on asp,net page


in asp.net can i make public objects on my page, for example

public Customer cust1 = new customer();

and use this object on my entire code???

what are the drawbacks of creating public objects??

a single object will be created for all users??? or each user will have a different object????

Certificate API question - Private Key.

I am trying to follow http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2.aspx but I am finding that the Private Key property of the certificate is always null. I created the certificate with makecert -pe -n "CN=BuySeasonsThirdParty" -r -b 08/26/2010 -e 08/26/2011 -sky exchange Amazon.cer. Then installing it on the local user store using: X509Store store = new X509Store(storeName, StoreLocation.CurrentUser); and using the same API to get the certificate from the store. The certificate that I retrieve from the store is non-null it is just the PrivateKey is null. So I can encrypt using something like: ((RSACryptoServiceProvider)cert.PublicKey.Key).Encrypt(Encoding.Unicode.GetBytes(text), true)   But since the Private Key property is NULL I cannot decrypt. Any ideas? Kevin

System.Messaging - Error accessing properties of remote private queues - "UnsupportedFormatNameExcep

I'm having some difficulty accessing private queues on a remote machine, but no trouble using remote public queues or private queues on a local machine. Calling: System.Messaging.MessageQueue.GetPrivateQueuesByMachine("machine"); ..succesfully returns the array of private queues on the remote machine.  However, trying to access nearly all of the properties on these MessageQueue objects returns: MessageQueueErrorCode: UnsupportedFormatNameOperation Message:"The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted." I have no trouble accessing queues created identically on the local machine using GetPrivateQueuesByMachine("."), plus accessing public queues using GetPublicQueuesByMachine("machine") also returns MessageQueue objects that are useable. The FormatName returned appears to be valid, as you would expect from queues retreived via GetPrivateQueuesByMachine().  e.g: FormatName:Direct=OS:machine\\private$\\example ..so I think the error message returned may be somewhat spurious. The permissions on the queues all appear to be set correctly.  I had even attempted allowing "Full Control" to "Everyone" on these queues as an experiment, with the same results. Any ideas for other things I might try? p.s. I am running Windows XP SP2, using .NET 2.

Private Security Model Integration

Does anyone have any recommendations on tieing the Microsoft AS security model in with an independent security model. We are at the beginning process to discuss this with a very large international partner and are looking for recommendations form anyone who has done this before. Thanks in advance Alan

MSSQL CE 3.5 SP2 Private Deployment

I use Visual C# express 2008 for my development.  I use MSSQL CE3.5 SP1 and have deployed this will my application for over a year as a private deployment (just included all the DLLs in my project).  This has worked well and kept me from being dependent on the product deployments.  I am running into an issue with the application deploying on Windows 7 64-bit home edition.  From my readings it seems that I need to upgrade to the MSSQL CE 3.5 SP2 but the indication is that I need to deploy 32-bit and the 64-bit SP2 for the 64-bit environements.  Since my development environment is on Windows XP I have not found a way to obtain the 64-bit version of the DLLs to include in my project as a private deployment.  Can I do this?  Is there a better way?  Where can I get the 64-bit DLLs. Thanks in advance for any help anyone can provide.David Allen
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend