|
Hi, having trouble decrypting a buffer using RSA. Did you find solution to the problem yet? Here's the code - I've highlighted the problem with "QUESTION" tags. Here's my code, please take a look. Thanks.
using System;
using System.Text;
using System.Security.Cryptography;
namespace tryRSA
{
///
/// Summary description for Class1.
///
class Class1
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{ //Main
int index=0;
int iterations=0;
int blocksize=0;
int KeySizeByte=0;
byte [] btSecret;
byte [] btEncryptedSecret;
byte [] btDescrambledSecret;
byte [] btPlainTxtToken;
byte [] btEncryptedToken;
string secret = "This is a long secret";
ASCIIEncoding AE = new ASCIIEncoding();
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
KeySizeByte = RSA.KeySize/8;
blocksize = KeySizeByte -11; //QUESTION 1: I've been told that blocksize is equal Key size less 11 bytes. How'd you know that?
Console.WriteLine("Key size: {0}", KeySizeByte);
Console.WriteLine("blocksize: {0}", blocksize);
btSecret = AE.GetBytes(secret);
if(btSecret.Length % blocksize != 0)
{
iterations = btSecret.Length/blocksize +1;
}
else
{
iterations = btSecret.Length/blocksize;
}
index=0;
btPlainTxtToken = new byte [blocksize];
btEncryptedSecret = new byte [iterations*blocksize];
for(int i=0; i
|
|
|
|
|
Is there any method in drawing namespace to draw rounded rectangles? I couldn't find any thing useful through this namespace.
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
|
Is it possible to run my
C# console application on Unix?
|
|
|
|
|
|
|
|
Hello Guru,
How do you play avi movies files such as deleting, copying, etc. in C#? I there a movie or animation control for this?
Thanks so much,
Khang Nguyen
|
|
|
|
|
I saw some kind of Animation Control under Dialog Editor tab of Toolbox but it's disabled and can't drag it out onto a form or dialog. How can you enable this Animation Control?
Thanks,
Khang Nguyen
|
|
|
|
|
hello,
here is a small problem i am facing,
here it is: can i run my c# program on Linux. i.e. say i have a c# program (windown platform) and i want it to run on Linux, now can I?
looking for guidance,
KHURRAM.
Asim
|
|
|
|
|
|
I have some Mdiclient who's windowsState is "Maximized" and where minimumBox and maximumBox is set to false.
ControlBox is set to false.
FormBorderStyle is "FixedToolWindow".
But still there is 3 icons in top right, when the mdiClient is Maximized....
And there is also a restore icon in top left.
How do I remove these icons, so that my MdiClient always is Maximized??
See:
http://csharp.users.whitehat.dk/mdi.jpg
Thanks
|
|
|
|
|
I belive you set the control box property to false.
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
George Carlin wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
Jörgen Sigvardsson wrote:
If the physicists find a universal theory describing the laws of universe, I'm sure the a**hole constant will be an integral part of that theory.
|
|
|
|
|
No it won't work.
If the MdiClient is maximized, then the 3 icons are still there.
Anyway, the icon on top left is also there.
|
|
|
|
|
I tried this and it worked for me. No icons are displayed.
My MDIClient window had following properties
1. MaximizeBox - false
2. MinimizeBox - false
3. ControlBox - false
4. FormBorderStyle - FixedDialog
5. WindowState - Normal
Try with these property values and it should work!
Suhas
|
|
|
|
|
To get the user from directory service the below code works perfectly fine.
But i want to access files in the user name ou=myname. I have place a text file name note.txt in myname writeing this addres in explorer
ftp://.admin.myname.user.novell@nldap.com/USER/myname/
all i want to know how to access the files. How can i get the files which i have uploaded on myname..... so i can modify n delete them also.
i have got the help to add user modify user n delte user but not abot the files of users ...
string path = "LDAP://www.nldap.com";
System.DirectoryServices.DirectoryEntry entry = new .DirectoryServices.DirectoryEntry(path);
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher(entry);
mySearcher.Filter = ("(ou=myname )");
SearchResult result = mySearcher.FindOne() ;
if( result != null )
{
Console.WriteLine("User found");
foreach( string key in result.Properties.PropertyNames )
{
// Each property contains a collection of its own
// that may contain multiple values
foreach( Object propValue in result.Properties[key] )
{
Console.WriteLine(key + " = " + propValue);
}
}
}
else
{
Console.WriteLine("User not found");
}
|
|
|
|
|
I am interested in putting up some sort of "Please Wait" or other animated gif while a long search executes. I have created a popup with javascript launced with a button attribute. But I cannot close the page easily. Any suggetions on this or even a better way to do it would be great. thanks.
|
|
|
|
|
Add this to the top of the search page (the one that actually outputs the processing):
<script>
var waitwin ;
function waitwindow()
{
waitwin = open('',"","width=10,height=10,left=400,top=100,scrollbars=0")
waitwin.document.open();
waitwin.resizeTo(1, 1);
}
</script>
Right when you start processing search, do this:
<script>
waitwindow();
waitwin.document.write('< p align="center">Please Wait< /p>');
</script>
when the search ends, output this:
<script>
waitwin.close();
</script>
Make sure the page is not buffered, or it'll wait until then end and flash everything open and closed at once.
|
|
|
|
|
hi.
I have a treeview that has a context menu associated with it. When I run the application and select a node then right click on another node, the context menu appears, but since the node isn't "selected" (the focus reticle is on the left-clicked node), the contextmenu doesn't work right since it performs it's actions on treeview1.SelectedNode.
I hope I have explained myself cleary. I am looking for a way to update selectednode and move the focus reticle to the node where the context menu was popped up.
|
|
|
|
|
|
worked like a charm. thanks
|
|
|
|
|
what scewey logic is c# using for scope?
why does the second declaration of lenum cause this code not to compile ? but j is ok ?
using System;
using System.Collections;
public class Test {
public static int Main(String[] args) {
ArrayList b = new ArrayList();
ArrayList c = new ArrayList();
for( int i = 0; i < b.Count; i++ ) {
if( true ) {
IEnumerator lenum = b.GetEnumerator();
while( lenum.MoveNext() ) {
int j = 0;
j++;
}
}
IEnumerator lenum = c.GetEnumerator();
while( lenum.MoveNext() ) {
int j = 0;
j++;
}
}
return 0;
}
}
|
|
|
|
|
My guess is that the C# compile knows that the if( true ) block will ALWAYS be executed and optimizes the if statement out. The result is that lenum = b.GetEnumerator() and lenum = c.GetEnumerator() are in the same scope.
Roger Stewart
"I Owe, I Owe, it's off to work I go..."
|
|
|
|
|
i just did that as a short example. my actual code where i found that oddity does the same thing.
|
|
|
|
|
This is no different to C. Just brace it.
public class Test
{
public static int Main(String[] args)
{
ArrayList b = new ArrayList();
ArrayList c = new ArrayList();
if( true )
{
IEnumerator lenum = b.GetEnumerator();
while( lenum.MoveNext() )
{
int j = 0;
j++;
}
}
{
IEnumerator lenum = c.GetEnumerator();
while( lenum.MoveNext() )
{
int j = 0;
j++;
}
}
return 0;
}
}
leppie::AllocCPArticle("Zee blog");
|
|
|
|