cryptography

ProtectedData.Unprotect() after Impersonate()

The following code doesn't work: IntPtr token = Win32Dll.LogonUser(“user1”, “mydomain”, “password1”); WindowsIdentity id = new WindowsIdentity(token); WindowsImpersonationContext ic = id.Impersonate(); byte[] unprotectedBytes = ProtectedData.Unprotect(passwordBytes, null, DataProtectionScope.CurrentUser); password = Encoding.Unicode.Get...

Can information encoded with a one time pad be distinguished from random noise?

I understand that the cyphertext from a properly used one time pad cypher reveals absolutely no data about the encrypted message. Does this mean that there is no way to distinguish a message encrypted with a one time pad from completely random noise? Or is there some theoretical way to determine that there is a message, even though you ...

Generating a salt in PHP

What's the best way to generate a cryptographically secure 32 bytes salt in PHP, without depending on libraries seldom included in typical PHP installations? After some googling I discovered that mt_rand is not considered secure enough, but I haven't found a suggestion for a replacement. One article suggested reading from /dev/random bu...

RSA Public key created in C# is not saved in iPhone keychain

Hello. I'm trying to send RSA public key from C# server to iPhone, so I could encrypt info on iPhone and decrypt it in C# server. But when I save received public key in iPhone, it's not saved. I create key in C# like this: RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(1024); byte [] body = rsa.exportCspBlob(false); ...

How can I decrypt password string in PHP which was encrypted with crypt?

How can I decrypt a password string in PHP which was encrypted with crypt? $salt = substr($_POST['password'], 0, 2); $password = crypt($_POST['password'], $salt); I need to send the original password in a forget password e-mail. ...

C# HMAC Implementation Problem

I want my application to encrypt a user password, and at one time password will be decrypted to be sent to the server for authentication. A friend advise me to use HMAC. I wrote the following code in C#: System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); byte[] key = encoding.GetBytes("secret"); HMACSHA256 myhmacsha25...

What exactly is a "key container"?

Is it something specific, with a definite structure, or just an arbitrary data file with some form of encryption to hold keys, and potentially other secret information? Can someone please explain the term or point me to a link. ...

Open Source Crytography Library .Net

That is not GPL. I'm looking for a Cryptography library for C# that can be used in commercial applications either for free, or for a small price. ...

RijndaelManaged: IV Generation?

I want to implement the most secure, and most reliable form of symmetric key cryptography in my application. The user should input a password to encrypt/decrypt, and that's all. For RijndaelManaged, one must enter a key and an IV. I'm not sure how to address the situation. Right now, I have the entered password being hashed by SHA256 ...

Free Cryptography libraries

Hi all. What are the most stable and useful Cryptography libraries, that they are: written with/for python, c++, c#, .net opensource, GNU, or other free license ...

Converting a byte array to a X.509 certificate

I'm trying to port a piece of Java code into .NET that takes a Base64 encoded string, converts it to a byte array, and then uses it to make a X.509 certificate to get the modulus & exponent for RSA encryption. This is the Java code I'm trying to convert: byte[] externalPublicKey = Base64.decode("base 64 encoded string"); KeyFactory key...

Are there any security vulnerabilities in this PHP code?

Hi. I just got a site to manage, but am not too sure about the code the previous guy wrote. I'm pasting the login procedure below, could you have a look and tell me if there are any security vulnerabilities? At first glance, it seems like one could get in through SQL injection or manipulating cookies and the ?m= parameter. define ( ...

Whats wrong with my triple DES wrapper??

it seems that my code adds 6 bytes to the result file after encrypt decrypt is called.. i tries it on a mkv file.. please help here is my code class TripleDESCryptoService : IEncryptor, IDecryptor { public void Encrypt(string inputFileName, string outputFileName, string key) { EncryptFile(inputFileName, outputFileName, ...

Is it worth using https if you are not doing financial transactions?

Hey just a quick question for any experts out there. I have a site that lets users interact through messages and to sign up you just make a username and password, verify your age, and optionally, add an email. There isn't really any sensitive information I suppose. Is it worth using https. Will it prevent session hi jacking and will it h...

OpenPGP Signing

I'm reading RFC4880 in an attempt to produce an implementatdion of a subset of OpenPGP (RSA signatures) using http://phpseclib.sourceforge.net/. I have the publickey and compression-literal-signature packets parsed out. I can extract n and e and feed them to Crypt_RSA to construct a verifier. I tell it I'm using sha256. It then ne...

Where are the real risks in network security?

Anytime a username/password authentication is used, the common wisdom is to protect the transport of that data using encryption (SSL, HTTPS, etc). But that leaves the end points potentially vulnerable. Realistically, which is at greater risk of intrusion? Transport layer: Compromised via wireless packet sniffing, malicious wiretapping,...

Parsing X509 DSS Certificate to get P, Q, G and Y

I am trying to parse a X509 Certificate that contains a Digital Signature Algorithm (DSA) public key. Using the javax.security.cert.X509Certificate class and getPublicKey() method I've been able to get P, Q, G and Y: P: 0279b05d bd36b49a 6c6bfb2d 2e43da26 052ee59d f7b5ff38 f8288907 2f2a5d8e 2acad76e ec8c343e eb96edee 11 Q: 036de1 G: ...

blackberry smartcard reader example

I am writing an app for BlackBerry that utilizes a BlackBerry smartcard reader. There is not much documentation on the subject, so I'd really like if someone could give me starting examples. Basically, there is one RSA private key on the card plus a certificate (for paired public key). I would like to be able to encrypt/decrypt data and...

Which Secure Software Development Practices do you Employ?

I work on a project known as the Security Development Lifecycle (SDL) project at Microsoft (http://microsoft.com/sdl) - in short it's a set of practices that must be used by product groups before they ship products to help improve security. Over the last couple of years, we have published a great deal of SDL documentation, as customers ...

Mathematical attack on the Digital Signature Algorithm

Does anybody know the mathematics behind an attack on DSA where modulus p has p-1 made up of only small factors. In reality, this would not happen as the key generator would guarantee that this is not so. There is much information on the web on generating good input paramters for DSA so that it is hard to crack but no information on ho...