cryptography

is cryptoapi good?

i'm writing a crypto program that does stuff like hashing (sha1), encryption, digital signatues for win32 in c++ is built in cryptoapi secure, or should i use some other library like crypto++ i need maximum security and works on all systems xp and vista (and optionally 2000), but at same time i need to minimize exe size and so don't want...

Are the first 32 bits of a 160-bit SHA1 hash an acceptable substitute for a CRC32 hash?

I'm working on a .NET 3.5 project and I need a 32-bit hash value. There doesn't seem to be any methods in the .NET Cryptography classes that return a 32-bit hash (MD5 is 128 bits, SHA1 is 160 bits, etc.). I implemented a CRC32 class, but I find that the SHA1 and MD5 hashing functions that already exist are much faster. Would there be ...

generate sha hash in openssl

how do i generate sha-1, sha-2 using openssl libarary, searched google and could not find function or any example code ...

Can I use RSACryptoServiceProvider public/private keys to interop with Crypto++?

I've created a public/private key using RSACryptoServiceProvider and saved it as XML. I can use this to encrypt/decrypt/sign and verify data in .NET. I have another application which is intended to run on a Linux server. I'm developing it in C++ and I'm using Crypto++ for my cryptography needs. I want to share data between these two a...

Using "strong" JRE policy files with BouncyCastle

Cryptography newbie here... I'm trying to do 128-bit encryption using BouncyCastle with the code below. import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.security.KeyStore; import java.security.Security; import java....

How to digitally sign a PDF(or another document) in Java ?

What libraries can be used to digitally sign documents in Java? ...

Implementing secure, unique "single-use" activation URLs in ASP.NET (C#)

Hi, I have a scenario inwhich users of a site I am building need the ability to enter some basic information into a webform without having to logon. The site is being developed with ASP.NET/C# and is using MSSQL 2005 for its relational data. The users will be sent an email from the site, providing them a unique link to enter the speci...

How do I work around the missing crypto classes in silverlight 2/3?

I'm doing some work with a server side service I don't control. The following works fine in standard C#, but fails (due to missing crypto classes) in Silverlight 2 and 3. static String DecryptString() { s = "<cipherTextHere>"; byte[] toDecryptArray = Convert.FromBase64String(s); string key = "<key here>"...

Length of the data to decrypt is invalid.

I'm trying to encrypt and decrypt a file stream over a socket using RijndaelManaged, but I keep bumping into the exception CryptographicException: Length of the data to decrypt is invalid. at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) at Syst...

What does this error mean in the Botan crypto library?

I'm using the c++ crypto library called Botan, and at arbitrary times I am getting the following error at runtime. What does it mean? terminate called after throwing an instance of 'Botan::PRNG_Unseeded' what(): Botan: PRNG not seeded: X9.31(AES-256) ...

BouncyCastle RSAPrivateKey to .NET RSAPrivateKey

I'm creating a certificate distribution system to keep track of clients and stuff. What happens is: Client send CSR to Server Server checks and signs certificate Server sends Signed certificate to Client Client puts Signed certificate plus Private key in Windows store. So on the client this happens: //Pseudo Server Object: Server s...

Should one use Cryptographic message syntax (CMS) for this task?

Hello, I've the task to transfer small binary messages (1 or 2 kb long) between a desktop application and mobile devices. The messages should be encrypted asymmetrically (RSA for instance). From what I've learned one should use a hybrid cryptosystem for this kind of task: Generate random symmetric key Encrypt plain text with symmetric...

Why use an x.509 certificate to encrypt xml? Why not just transmit over https?

Don't know much about encryption... Say I'm preparing a SAML request to submit to an identity provider. Why would I need to apply an x.509 certificate to this request? Is transmission over SSL alone not secure enough? ...

How to calculate the inverse key matrix in Hill Cipher algorithm?

I am finding it very hard to understand the way the inverse of the matrix is calculated in the Hill Cipher algorithm. I get the idea of it all being done in modulo arithmetic, but somehow things are not adding up. I would really appreciate a simple explanation! Consider the following Hill Cipher key matrix: 5 8 17 3 Please use the...

Cryptography - Please help me understand Key Length Requirements

I'm having a bit of difficulty getting an understand of key length requirements in cryptography. I'm currently using DES which I believe is 56 bits... now, by converting an 8 character password to a byte[] my cryptography works. If I use a 7 digit password, it doesn't. Now, forgive me if I'm wrong, but is that because ASCII characters a...

PKCS#10 request for a object key pair from PKCS#11

Hello There I have a RSA 1024 key pair generated using standard call from PKCS#11. I need to generate a PKCS#10 CSR for the public key. MS has the IEnroll4 dll which will allow to raise a CSR using createRequestWStr. The samples indicate that you need to generate a new key pair(a container with 2 objects in MS CAPI) and MS automatical...

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

Hi, Basically i want to use System.Security.Cryptography.AesManaged (or a better class, if you think there is one?) to take one byte array and create another encrypted byte array, using a given symmetric key (i assume i'll need one?). I also will need the way to reverse this procedure. The point of this is so i can encrypt stored pass...

HashBytes conversion

select HASHBYTES('sha','what is it') Result --0x2327A09C2FDAD132E436B5CC12E9D5D283B5BA69 is it possible to convert back hashbytes to string '0x2327A09C2FDAD132E436B5CC12E9D5D283B5BA69' as a input want to get out put as 'what is it'? ...

CryptAPI native Interop with .NET Code

Hi, I have managed to encrypt data in native code using the Crypto API and decrypt this in .NET (C#) code, using RC2 algorithm and SHA for creating a key. This is the native code (Delphi in this case): // Get handle to CSP If Not CryptAcquireContext(hCryptProv, nil, nil, PROV_RSA_FULL, 0) Then If Not CryptAcquireContext(hCryptProv...

ICertRequest2::Submit CSR data Compatability ASCII to BSTR

Hello Experts, I have my certrequest as a PEM base64 data. See data below. 1) My understanding is that this is an ASCII data type and not in UNICODE format. Please clarify. -----BEGIN NEW CERTIFICATE REQUEST----- MIIBTjCBuAIBADARMQ8wDQYDVQQDEwZ3dTAwMzEwgZ0wDQYJKoZIhvcNAQEBBQAD gYsAMIGHAoGBAKP48eljetv3fVicT6g6hKjmLpsySJaZ/NnepEJEqtQQNbw...