|
You're planning to combine relatively insecure ways to hide a key with a very strong encryption algorithm? That strikes me as odd - it's a bit like having 10 locks on your door but putting the key under the doormat.
|
|
|
|
|
I second this comment!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Good call.
If you were using crypto appropriately, then you wouldnt need to hide the key that the user is going to use.
Alice can't send a secret message to Bob and then have Bob read it sometimes, but not other times. Maths doesnt work that way...
|
|
|
|
|
Ok. How can I Blowfish, Twofish or AES algorithims in ASP.NET project. All of them needs private key.
|
|
|
|
|
You can use them, but you should only use them to encrypt a communication channel. Anything else is not "encryptable" - you may try but it still won't be safe, no matter what.
|
|
|
|
|
Could you explain "encrypt a communication channel"? Is it means SSL certificiate installed and configured server?
|
|
|
|
|
Actually it's more like a fundamental theory in crypto.
Yes SSL "works", because it encrypts traffic between two computers, and that's a communication channel.
Encrypting a communication channel just means that there are 2 parties involved and they can talk to each other, but anyone else who happens to be listening only receives a garbled mess.
Encryption of data only works if the key is guaranteed not to fall into the wrong hands. This guarantee is what makes it impossible, because it means you can't tell to key to anyone, including the program that you want to decrypt the data. This is why passwords don't "work" - they can be stolen (key loggers, fake websites, phishing emails etc). If "the wrong hands" includes the person using the program, obviously the program should not have the key, because no matter what trickery you use the key will at some point be available to the program and thus also to the person operating the computer.
So what I hope, is that you only want to keep the data a secret from "others" - for example other people on the network (LAN/WAN whatever) who could overhear the communication between your site (it's a site right?) and a user. SSL does this, but you could use other algorithms as well (if the client allows it, if it's a program you control you could use anything you want). If the algorithm you want to use is not a public key algorithm you could use something like the Diffie-Hellman exchange to effectively turn it into a public key algorithm.
ps: please do not sue me if you find any errors in what I just said
|
|
|
|
|
I am having a little issue that I figured Microsoft would of changed.
So I am trying to do my reports, which I can only figure out how to do with Datasets. I typically do not use datasets and do everything by writing the code when connecting, and retrieving/insertings information into a database.
So anyways, I am storing everything in the applications settings. Before inserting the information I am encrypting the words so you cannot read it in the XML file. One problem I am having though is that you cannot write a connectionstring. It is readonly?!?
So how do I do these reports (Microsoft reports) without using Datasets?
|
|
|
|
|
well,
what visual studio does when storing connection strings is, it only codes the get method of the "connection string" property. this is an auto generated code,you will find it in a file called "Settings.Designer.cs"
you will find a code roughly like this
<br />
[global::System.Configuration.ApplicationScopedSettingAttribute()]<br />
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]<br />
[global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.ConnectionString)]<br />
[global::System.Configuration.DefaultSettingValueAttribute("Default Connetction string")]<br />
public string Setting {<br />
get {<br />
return ((string)(this["Setting"]));<br />
}<br />
set<br />
{<br />
this["Setting"] = value;<br />
}<br />
}<br />
delete the default connection string and assign it before trying to fill the dataset
hope it works for you,
|
|
|
|
|
Sweet that looks like exactly what I needed! Thanks!
|
|
|
|
|
how do we make a network in graph topology.
|
|
|
|
|
I have no idea what you are on about. Is this a network related question by any chance. i.e. wrong forum?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi. Until now, I've been working only in C#, but only Web Sites. Now I tried to make something in C# for Applications and I have this problem: when you make Web Sites, you have DropDownList. In the dropdownlist I can assign a value to each member from the list and get it later with
DropDownList1.SelectedItem.Value; With the combobox in applications I don't have the same value option. When I write
comboBox1.SelectedItem I don't have the option to retrieve or to assign a value to the item I'm putting in the list.
I need this option for working with databases, because I fill the combobox from a database, and I want the value of the items to be the ID assigned in the database. I use Visual Studio 2008.
|
|
|
|
|
comboBox1.SelectedValue and you have to use DataSource , DisplayMember and ValueMember .
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I have a list view with 3 columns and I want to display an image in 3rd column during run time.
I've not find any direct method to do this, Then I approached DrawSubItem event. But I am not able to achieve my requirement as it is continuosly paiting.
I think I need to go for customization. But I am new to C# and I am in need of somebody's help.
Can anyone please help me in getting the solution?
|
|
|
|
|
http://www.codeproject.com/KB/list/OAKListView.aspx[^]
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi all,
How to convert html to pdf?
I am using Itextsharp.dll as my library, cause i found 2 other library but are under License so i cant use it
i tried to follow the ExpertPDF method of geting the property but i just cant not get it to work
private PdfDocument GetPDFConverter()
{
int pageWidth = 0;
int pageHeight = 0;
PdfDocument pdfConverter = new PdfDocument(pageWidth, pageHeight); <-- (The type 'iTextSharp.text.pdf.PdfDocument' has no constructors defined)
pdfConverter.GetRight = false; <--error also
return pdfConverter;
}
How can i do it?
As i not sure how to read the data from the library
Thank You
|
|
|
|
|
|
I would follow Yusuf[^]'s advice below where you posted a very similar question[^].
|
|
|
|
|
Hi,
I'm having trouble getting the UDPClient to work with C#.
The udpClient has connected and sent a signal to 127.0.0.1 on port 8050 with no exceptions thrown. On the below line of code,
int recv = server.ReceiveFrom(data, ref tmpRemote);
I receive the below exception error,
at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint& remoteEP)
RemoteIPEndPoint is defined using the following line of code,
IPEndPoint sender = new IPEndPoint(IPAddress.Parse("127.0.0.1"),8050);
EndPoint tmpRemote = (EndPoint)sender;
Any ideas why it throws the exception and how to solve it?
modified on Thursday, March 12, 2009 1:02 AM
|
|
|
|
|
mrithula8 wrote: Any ideas why it throws the exception and how to solve it?
Nope.
That info is contained in the SocketException object that gets thrown. You need to catch it and either print it or use the debugger to view it and find out what's going on.
|
|
|
|
|
Hi,
I used the SocketException to catch the exception
It displays the exception that the existing connection was forcibly closed by the remote host.How do i find where the connection is getting closed?Can you give some suggestions
//client
private void SendMessage()
{
try
{
listBox6.Items.Add("Connecting....");
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8050);
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendBuffer, 1);
listBox6.Items.Add("Connected");
byte[] data = new byte[1024];
String snd = "hello";
data = Encoding.ASCII.GetBytes(snd);
listBox6.Items.Add("Transmitting...");
sock.SendTo(data, 0,data.Length, SocketFlags.None, ipep);
listBox6.Items.Add("Sent...");
EndPoint tmpRemote = (EndPoint)ipep;
listBox6.Items.Add("Message received from {0}:");
listBox6.Items.Add(ipep.ToString());
data = new byte[1024];
int recv = sock.ReceiveFrom(data,0,data.Length, SocketFlags.None, ref tmpRemote);
String zz=Encoding.ASCII.GetString(data, 0, recv);
listBox6.Items.Add(zz);
if (zz == "Welcome to the Server")
{
lb9.Text = "Active";
lb9.BackColor = Color.Green;
}
else{
lb9.Text = "Inactive";
lb9.BackColor=Color.Red;
}
}
catch (SocketException e)
{
MessageBox.Show(e.Message);
}
}
//server
public static void start_server()
{
IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8050);
Socket newsock = new Socket(AddressFamily.InterNetwork , SocketType.Dgram, ProtocolType.Udp);
newsock.Bind(ipep);
Console.WriteLine("Waiting for a client...");
while (true)
{
try
{
EndPoint tmpRemote = (EndPoint)ipep;
byte[] data = new byte[1024];
Console.WriteLine("hai");
int recv = newsock.ReceiveFrom(data, 0, data.Length, SocketFlags.None, ref tmpRemote);
Console.WriteLine("gfgjfk");
Console.WriteLine("Message received from {0}:", tmpRemote.ToString());
Console.WriteLine(Encoding.ASCII.GetString(data, 0, recv));
String st = data.ToString();
data = new byte[1024];
string ss = "Welcome to the Server";
data = Encoding.ASCII.GetBytes(ss);
newsock.SendTo(data,0, data.Length, SocketFlags.None, tmpRemote);
Console.WriteLine("\nSent Acknowledgement");
}
catch (SocketException e)
{
Console.WriteLine(e.Message);
}
}
}
|
|
|
|
|
MSDN says that you have to call Socket.Bind(...) before you call Socket.ReceiveFrom(...) . I see where you're doing that in your server code but not your client. I'd try adding a call to that function to the client.
If you still have lots of problems getting Socket s to work then I'd suggest you take a look at the UdpClient[^] class. It simplifies a lot of things and makes sockets easier to work with.
|
|
|
|
|
Your exception is probably something to do with the buffer, offset, and size. here are some guidelines that may help you understand and solve your problem:
The "buffer" must be large enough to accomodate the largest UDP datagram you expect to receive. Make sure you have a buffer that is large enough for you application. For example byte[] buffer = new buffer[1024];
Next, "offset" is the index to the buffer. First recv this is probably zero (0). Next recv it may be advanced by the value from the datagram PDU, e.g. a size of payload. The key here is offet MUST be with the bounds of the buffer 0 to n.
You should advance the offset by the bytes recv'd like this (with error checking of ocurse):
int nbytes = recv(buffer, offset, size, ...);
offset += nbytes
"Size" is determines how much. Let's say your first read got a 12 byte Header and in this header you extract a length. Well that means you would have used 12 for the first recv, and the if the payload size from the Header was 146 bytes, then your second recv would be for that amount. BUT you must make sure the offset advances before the second recv. Make sure you process recv errors, such as:
int nbytes = recv(buffer, offset, size, ...);
if (nbytes > 0)
offset += nbytes;
else
ProcessSocketError();
Good luck
|
|
|
|
|
Hello.
I'm trying to get an object to go where a mouse click occurs, my XAML:
<pre><Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="bricksMenu.Window1"
x:Name="Window"
Title="Window1"
Width="640" Height="480" Background="Black">
<Canvas Name="baseCanvas" MouseDown="baseCanvas_MouseDown">
<Canvas Name="whiteSquare" Width="50" Height="50" Background="White" Canvas.Left="25" Canvas.Top="25"/>
<Canvas Name="redSquare" Width="50" Height="50" Background="Red" Canvas.Left="50" Canvas.Top="50"/>
</Canvas>
</Window></pre>
and the C Sharp behind:
<pre>namespace bricksMenu
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
this.InitializeComponent();
// Insert code required on object creation below this point.
}
private void baseCanvas_MouseDown(object sender, MouseButtonEventArgs e)
{
double mouseX;
double mouseY;
Point position = e.GetPosition(this);
mouseX = position.X;
mouseY = position.Y;
DoubleAnimation followMouseX = new DoubleAnimation(mouseX, TimeSpan.FromMilliseconds(600));
DoubleAnimation followMouseY = new DoubleAnimation(mouseY, TimeSpan.FromMilliseconds(600));
redSquare.BeginAnimation(Canvas.LeftProperty, followMouseX);
redSquare.BeginAnimation(Canvas.TopProperty, followMouseY);
}
}
}</pre>
The idea is you click on the black background, the red square goes to that point. However, I need to click on the red sqaure to make anything happen, even though the event dispatcher is not on that canvas. Any ideas?
Regards, E.
|
|
|
|
|