Click here to Skip to main content
15,886,799 members
Home / Discussions / C#
   

C#

 
AnswerRe: Function Caller Pin
Mycroft Holmes23-May-09 23:35
professionalMycroft Holmes23-May-09 23:35 
Questiondownload at internet bandwith with c# Pin
Abdul Rahman Hamidy23-May-09 22:26
Abdul Rahman Hamidy23-May-09 22:26 
Question[Message Deleted] Pin
hkjghkj123-May-09 21:28
hkjghkj123-May-09 21:28 
AnswerRe: filter Pin
Eddy Vluggen23-May-09 21:51
professionalEddy Vluggen23-May-09 21:51 
General[Message Deleted] Pin
hkjghkj123-May-09 23:34
hkjghkj123-May-09 23:34 
GeneralRe: filter Pin
Eddy Vluggen23-May-09 23:48
professionalEddy Vluggen23-May-09 23:48 
QuestionTo add headertemplate and contenttemplate of a TabContainer Programaticaly [modified] Pin
Shahdat Hosain23-May-09 20:48
Shahdat Hosain23-May-09 20:48 
QuestionDESCryptoServiceProvider - key size (public key from mykeys.snk not compatible) Pin
devvvy23-May-09 18:56
devvvy23-May-09 18:56 
hello

Having trouble with DESCryptoServiceProvider - specifically, key size of public key from extracted from "mykeys.snk" (using sn.exe, byte[160]) not compatible with DESCryptoServiceProvider which is expecting byte[24].

Here's how I extract public key from snk file:
<br />
FileStream oKeyPairFileStream = File.OpenRead("mykeys.snk");<br />
			System.Reflection.StrongNameKeyPair oKeyPairFile = new StrongNameKeyPair(oKeyPairFileStream);<br />
			byte[] btPublicKey = oKeyPairFile.PublicKey;<br />
			return btPublicKey;<br />


Here's how I do encrypt:
<br />
byte[] btGeneratedKey = null;<br />
				tDESalg.GenerateKey();<br />
				btGeneratedKey = tDESalg.Key; <br />
				tDESalg.Key = btKey; // NOTE: Could have used "tDESalg.GenerateKey()" Instead. But I am trying to use public key from snk file instead!<br />
<br />
				tDESalg.Mode = CipherMode.ECB;<br />
				tDESalg.Padding = PaddingMode.PKCS7;<br />
 <br />
				CryptoStream cStream = new CryptoStream(oMemStream,<br />
									new TripleDESCryptoServiceProvider().<br />
										CreateEncryptor(btKey, tDESalg.IV),<br />
									CryptoStreamMode.Write);<br />


This would give error message:
<br />
"Specified key is not a valid size for this algorithm."}	System.Exception {System.Security.Cryptography.CryptographicException<br />


I got a feeling you can't use key from snk file to encrypt by way of DESCryptoServiceProvider, am I right?

Thanks

dev

QuestionCrystal report Pin
KIDYA23-May-09 18:50
KIDYA23-May-09 18:50 
AnswerRe: Crystal report Pin
_Maxxx_24-May-09 16:57
professional_Maxxx_24-May-09 16:57 
QuestionX509 makecert from snk file (sn.exe)? Pin
devvvy23-May-09 17:44
devvvy23-May-09 17:44 
QuestionThreeState checkBox? Pin
Xenoserv23-May-09 16:17
Xenoserv23-May-09 16:17 
AnswerRe: ThreeState checkBox? Pin
Mycroft Holmes23-May-09 16:40
professionalMycroft Holmes23-May-09 16:40 
GeneralRe: ThreeState checkBox? Pin
Xenoserv23-May-09 17:02
Xenoserv23-May-09 17:02 
GeneralRe: ThreeState checkBox? Pin
Mycroft Holmes23-May-09 17:45
professionalMycroft Holmes23-May-09 17:45 
AnswerRe: ThreeState checkBox? Pin
Luc Pattyn23-May-09 17:05
sitebuilderLuc Pattyn23-May-09 17:05 
AnswerRe: ThreeState checkBox? Pin
PIEBALDconsult23-May-09 17:52
mvePIEBALDconsult23-May-09 17:52 
GeneralRe: ThreeState checkBox? Pin
Xenoserv23-May-09 21:20
Xenoserv23-May-09 21:20 
AnswerRe: ThreeState checkBox? Pin
DaveyM6924-May-09 0:53
professionalDaveyM6924-May-09 0:53 
QuestionInstall Files In Root Directory Pin
BlitzPackage23-May-09 12:30
BlitzPackage23-May-09 12:30 
AnswerRe: Install Files In Root Directory Pin
Luc Pattyn23-May-09 12:40
sitebuilderLuc Pattyn23-May-09 12:40 
GeneralRe: Install Files In Root Directory Pin
BlitzPackage23-May-09 12:54
BlitzPackage23-May-09 12:54 
GeneralRe: Install Files In Root Directory Pin
Luc Pattyn23-May-09 13:04
sitebuilderLuc Pattyn23-May-09 13:04 
GeneralRe: Install Files In Root Directory Pin
BlitzPackage23-May-09 13:15
BlitzPackage23-May-09 13:15 
AnswerRe: Install Files In Root Directory Pin
harold aptroot23-May-09 12:59
harold aptroot23-May-09 12:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.