|
Hey Luc,
Rather than span the forum with numerous posts along the way, the idea was to figure out what was wrong and then post that, not the entire process of getting there.
Cheers
|
|
|
|
|
Have you considered using the ProcessCmdKey overload or event ??? instead of keypress event
With great code, comes great complexity, so keep it simple stupid...
|
|
|
|
|
Hello everybody,
I don't know if here is the right section, if not, please change.
I need some support with this questions.
I will present here my problem:
Suppose I want a software to give to someone to encrypt text, and to encrypt the program should use the privatekey ( that only I know, but the program will need to encrypt data, so it must be hidden there) and to decrypt it should use the public key, that I can give to anyone.
So, now:
I have a private key and a public key, generated by open ssl: privatekey.pem and publickey.pem
Now, I need to be able to use those keys to encrypt and decrypt data.
the thing is, how I load the .pem to the program?
As I readed I need to load it to rsaparameters, but how I do it?
The type of the keys are:
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKB...
and
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBA...
Any help would be very usefull, since I'm having a lot of troubles making it.
|
|
|
|
|
|
Alegria_Lee Thanks a lot!
I will study this example today, and try to solve my problem. But this seams really helpfull.
I'll post here if I get it working or not. If you dont mind, stay checking here.
|
|
|
|
|
Ok, It helped me a lot. Now I'm able to use my own private/public keys. Without any problem
Now, the thing is:
I need to encrypt the data using the private key.
And I need to decrypt it using the public key.
But RSA dont let me... I can encrypt with the private key, but them, I cant decript with the public one.
modified on Friday, October 15, 2010 9:46 AM
|
|
|
|
|
I'm glad it's helpfull for you.
Actually,I haven't used this before.
|
|
|
|
|
well, but is good and is working
thank you a lot.
|
|
|
|
|
You're welcome.
By the way,Have you find out a solution to solved your problem ?(" encrypt with private key and decrypt with public key ")
AS i know,RSA can not seem to do so .
|
|
|
|
|
yes, is not possible.
But I noticed that what I wanted it could be made with the method: signdata
It signs data with private key and unsign with public key =)
|
|
|
|
|
Hello!
I have a problem with getting the pixels from an image. I load a image, select a pixel from the image and retrieve it's color and then i generate a matrix indexMatrix[bitmap_height][bitmap_width] which contains 1 or 0 depending if the [x,y] color of the bitmap is the same as the color selected. The problem is that the program doesn't select all the pixels although it should. Here are some images of the bitmap and the bitmap generated from the matrix :
original:
http://img233.imageshack.us/i/hartap.jpg/
after matrix generation and the transform from the matrix to the new image
http://img826.imageshack.us/i/60079199.jpg
The wierd thing is that if i run my program for the new image ( the one constructed from the matrix ) it returns the same image( as it should ) but i can't figure out how to fix the problem.
Please Help!!!
Regards,
Alex Badescu
and some code from my project :
bitmap declaration:
m_Bitmap = (Bitmap)Bitmap.FromFile(openFileDialog.FileName, false);
Here i calculate the matrix:
int bitmapWidth = m_Bitmap.Width;
int bitmapHeight = m_Bitmap.Height;
indexMatrix = new int[bitmapHeight][];
if (imageIsLoaded && colorIsSelected)
{
for (int i = 0; i < bitmapHeight; i++)
{
indexMatrix[i] = new int[bitmapWidth];
for (int j = 0; j < bitmapWidth; j++)
{
Color temp = m_Bitmap.GetPixel(j, i);
if (temp == selectedColor)
indexMatrix[i][j] = 1;
else indexMatrix[i][j] = 0;
}
}
MessageBox.Show("matrix generated succesfully");
}
matrixIsCalculated = true;
}
|
|
|
|
|
Try using Color.ToArgb() method for the comparisons. ie,
if(temp.ToArgb() == selectedColor.ToArgb())<br /> The equality operator uses some state flags for the comparison in addition to the ARGB values.
|
|
|
|
|
|
I'm afraid there is a fundamental flaw in your approach: JPEG images tend to be highly compressed, which means every pixel is approximated in such a way that fewer bits are required. Applying an equal-test on jpegged images does not make much sense. What you should do is allow for some deviation, say:
deviation=deltaRed*deltaRed+deltaGreen*deltaGreen+deltaBlue*deltaBlue
or similar in another color space (e.g. HSB).
Only when the deviation is large enough you should call the pixel "not blue".
BTW: why don't you use a normal 2D matrix, as in int[bitmapWidth, bitmapHeight]?
|
|
|
|
|
I have custom windows user control. It is just a textbox puted on a panel. And panel is on User control. The panel OnPaint is overriden.
Everything looks fine except when some form comes on the control or menu open on it and I move or close the above form, the user control looks does not refresh completely extra lines from closed form remain on the panel. Should I call Invalidate() or Refresh() from specific event of user control?
Thanks
Mazy
"This chancy chancy chancy world."
|
|
|
|
|
does your Paint handler contain a base.OnPaint() ?
|
|
|
|
|
Hello,
I use a ColorEdit control in my form ( as picture )
I need to analyse the case when the user choose a color from Custom tab which the color is represtend in RGB structure as I know
the problem that i need to translate this value (ie 245;245;220) to the color name (ie "beige") that i can save it after to use an other time by methode Color.FromName(name)
please can someone help me.
thank you
http://yfrog.com/63clipboard01kg[^]
|
|
|
|
|
You can use the FromArgb method and pass it the integer values. That would make converting it obsolete. Not all values can be converted to a name either so converting would mean omitting many possibilities.
V.
|
|
|
|
|
So when its unknown color (ie its choosed in custom tab and not exist in the array of known colors)
how can i get its name?
|
|
|
|
|
That's the thing, you can't. You should save it's RGB values, not the name.
V.
|
|
|
|
|
Think about it. 8 Red bits, 8 Green bits, 8 Blue bits. (and 8 alpha channel, but lets ignore those for a moment)
2^8 * 2^8 * 2^8 = 256 * 256 * 256 = 16,777,216 different colours.
Who do you think is going to name them all? The whole of the English language has less than 1 million words.
If you used each of them for a colour, you would still need French, and German, and Spanish, and Italian, and Manderin, and ...
Use the numbers, Luke!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
I do.
|
|
|
|
|
I was going to reply that I didn't remember proposing , but...
...then I read my post and realised what you were talking about.
I'm sure you meant to say:
Luc Pattyn wrote: [AsthmaticVoice] I do. [/AsthmaticVoice]
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
You can't, or at least you shouldn't.
All colornames map to a hex value (though not reliably), but not all hex color values map to a color name.
Additionally, different systems have different colornames.
|
|
|
|
|
Yeah, what they said.
If it was an easy task Microsoft would have provided it already.
I store (database, XML, etc.) the value as #AARRGGBB; it works.
|
|
|
|