tagged [cryptography]

algorithm - Is the RijndaelManaged Class in C# equivalent to AES encryption?

algorithm - Is the RijndaelManaged Class in C# equivalent to AES encryption? I am asking this question to confirm whether the RijndaelManaged class in C# is equivalent to AES encryption. From what I h...

18 Jun at 14:44

Location of container for public and private keys in Windows?

Location of container for public and private keys in Windows? I am trying to store my public and private keys in a container using following code: What I'd like to know is the location of the containe...

Why am I getting "Invalid algorithm specified" exception

Why am I getting "Invalid algorithm specified" exception Here is my code. On the last line I'm getting the exception: >

15 Sep at 15:9

C#: How to generate short MD5 code?

C#: How to generate short MD5 code? When I am encrypting `23` using MD5 encryption I am getting `37693cfc748049e45d87b8c7d8b9aacd` this 32-character long string which will always be static for 23. I w...

10 Aug at 10:19

How to store/retrieve RSA public/private key

How to store/retrieve RSA public/private key I want to use RSA public key encryption. What is the best way to store or retrieve private and public keys? Is XML a good idea here? How to get the keys? B...

15 Aug at 20:11

Rfc2898 / PBKDF2 with SHA256 as digest in c#

Rfc2898 / PBKDF2 with SHA256 as digest in c# I want to use Rfc2898 in c# to derive a key. I also need to use SHA256 as Digest for Rfc2898. I found the class `Rfc2898DeriveBytes`, but it uses SHA-1 and...

6 Sep at 00:34

Has anyone got any code to call SignerSignEx from C#?

Has anyone got any code to call SignerSignEx from C#? Would really appreciate something that does the .Net equivalent of the SignerSignEx example here: [http://blogs.msdn.com/b/alejacma/archive/2008/1...

15 Jun at 12:37

'Malformed Reference Element' when adding a reference based on an Id attribute with SignedXml class

'Malformed Reference Element' when adding a reference based on an Id attribute with SignedXml class Unable to sign element by Id attribute when there's a namespace prefix: ``` void Main() { var doc ...

Why are primes important in cryptography?

Why are primes important in cryptography? One thing that always strikes me as a non-cryptographer: Why is it so important to use prime numbers? What makes them so special in cryptography? Does anyone ...

13 Apr at 16:18

How to use 'System.Security.Cryptography.AesManaged' to encrypt a byte[]?

How to use 'System.Security.Cryptography.AesManaged' to encrypt a byte[]? Basically i want to use System.Security.Cryptography.AesManaged (or a better class, if you think there is one?) to take one by...

9 Jun at 01:33

.NET Private Key Rsa Encryption

.NET Private Key Rsa Encryption I need to encrypt a string using an RSA 1.5 algorithm. I have been provided with a private key. However, I cannot for the life of me figure out how to add this key to t...

18 May at 01:49

How can I generate a cryptographically secure random integer within a range?

How can I generate a cryptographically secure random integer within a range? I have to generate a uniform, secure random integer within a given range for a program that generates passwords. Right now ...

21 Sep at 06:46

JWT web token encryption - SecurityAlgoritms.HmacSha256 vs SecurityAlgoritms.HmacSha256Signature

JWT web token encryption - SecurityAlgoritms.HmacSha256 vs SecurityAlgoritms.HmacSha256Signature For token based authentication `Microsoft.IdentityModel.Tokens` provides a list of security algorithms ...

17 Mar at 19:25

Encrypt cookies in ASP.NET

Encrypt cookies in ASP.NET I would like to encrypt cookies in ASP.NET. I have followed [the method in this article](http://www.codeproject.com/KB/web-security/HttpSecureCookie.aspx), but it has the dr...

5 Dec at 19:59

looking for c# equivalent of php's password-verify()

looking for c# equivalent of php's password-verify() I need to import a bunch of user accounts Moodle into a system written in c#. Moodle uses password_hash() function to create hashes of passwords. I...

24 Mar at 16:52

Compute a hash from a stream of unknown length in C#

Compute a hash from a stream of unknown length in C# What is the best solution in C# for computing an "on the fly" md5 like hash of a stream of unknown length? Specifically, I want to compute a hash f...

5 Nov at 21:59

Where to store AES key?

Where to store AES key? I am creating a web application with ASP.NET MVC, And I want to store some password into database. The passwords must be recoverable. (They are not for myself, I need passwords...

Difference between HMACSHA256 and HMACSHA512

Difference between HMACSHA256 and HMACSHA512 We are using the below code to generate a HMac hash against a sensitive value in C# ``` public string GenerateHMac(string key, string message) { var deco...

6 Aug at 12:40

C# Export Private/Public RSA key from RSACryptoServiceProvider to PEM string

C# Export Private/Public RSA key from RSACryptoServiceProvider to PEM string I have an instance of System.Security.Cryptography.RSACryptoServiceProvider, i need to export it's key to a PEM string - li...

2 Jan at 07:21

Can't find `DataProtectionScope` and `ProtectedData` classes in System.Security.Cryptography

Can't find `DataProtectionScope` and `ProtectedData` classes in System.Security.Cryptography I've referred the file `System.Security.dll` as described in [this article](http://msdn.microsoft.com/en-us...

28 Oct at 17:35

How do you use bcrypt for hashing passwords in PHP?

How do you use bcrypt for hashing passwords in PHP? Every now and then I hear the advice "Use bcrypt for storing passwords in PHP, bcrypt rules". But what is `bcrypt`? PHP doesn't offer any such funct...

C# How can I validate a Root-CA-Cert certificate (x509) chain?

C# How can I validate a Root-CA-Cert certificate (x509) chain? Let's say I have three certificates (in Base64 format) How can I validate the certs and certificate path/chain in C#? (All those three ce...

Fundamental difference between Hashing and Encryption algorithms

Fundamental difference between Hashing and Encryption algorithms I see a lot of confusion between hashes and encryption algorithms and I would like to hear some more expert advice about: 1. When to us...

23 May at 12:18

How to Verify Signature, Loading PUBLIC KEY From CRT file?

How to Verify Signature, Loading PUBLIC KEY From CRT file? I reviewed many forums and examples, but none helped me. I need verify signature from any webservice. I have test.crt file with public key fo...

Cryptography .NET, Avoiding Timing Attack

Cryptography .NET, Avoiding Timing Attack I was browsing crackstation.net website and came across this code which was commented as following: > Compares two byte arrays in length-constant time. This c...

6 Jun at 04:12