cryptography

Design problem: Secure / self-destructing email

As most of you know, email is very insecure. Even with a SSL-secured connection between the client and the server that sends an email, the message itself will be in plaintext while it hops around nodes across the Internet, leaving it vulnerable to eavesdropping. Another consideration is the sender might not want the message to be reada...

How to authenticate client based on possession of symmetric key?

Our clients call our web service over SSL and authenticate themselves with a username and password. Our server then generates a symmetric key and sends it back to the client. Then, the client establishes a TCP connection to our server, and sends a login message. At this point, I want to authenticate the client. My idea is to have the c...

Are EncryptByCert and DecryptByCert a secure way of encrypting?

I would like to use TDE, but I cannot use it, so I have chosen to use the EncryptByCert and DecryptByCert functions. However, I was also considering encrypting/decrypting data in c# as shown here. My question is are EncryptByCert and DecryptByCert unsecure because the certificate is also stored in the database? How do people get around ...

Android encryption

I am working on an android application, and I need to use encryption for one aspect of it. I am really indifferent to which algorithm I use (AES, DES, RSA, etc...). I am aware that Java has a crypto package, but I am not at all familiar with. Can someone post an example on how to do an encrypt/decrypt function? Thanks ...

Moving ECDSA from COM DLL to .NET

Hi, I have an ActiveX DLL that uses ECDSACom from Dragongate Technologies to create a signature for a product licence. The product, when starting, uses the signature generated, the public key and the licence to check if the licence is good. But now I'm changing to .NET and 64bit applications and the ECDSACom can't be used since is a COM ...

How to make TLS connection from PHP in web server, and safely

Suppose I have some PHP code running inside a web server, for example, running a simple CakePHP app. From this app, I want to occasionally make a TLS connection out to some server to exchange some data. How is this typically done? (I have little experience with PHP.) What PHP plug-ins or libraries or whatever, are recommended to accompl...

PyCrypto problem using AES+CTR

Hi, I'm writing a piece of code to encrypt a text using symmetric encryption. But it's not coming back with the right result... from Crypto.Cipher import AES import os crypto = AES.new(os.urandom(32), AES.MODE_CTR, counter = lambda : os.urandom(16)) encrypted = crypto.encrypt("aaaaaaaaaaaaaaaa") print crypto.decrypt(encrypted) Here,...

Location of policy file on Debian

I'm working on an application/library, under DebianOS, that requires the presence of certain standard policy files (related to unlimited strength ciphers, 192, 256 bit AES keys). However, there seems to a problem which I think is related to the application not being able to find these policy files (.jar files). Sun recommends these fi...

HSM - cryptoki - Sessions - Timeout

My application access the HSM via a ASP.NET web service through PKCS#11. I initialise the cryptoki library and obtain a session handle. Web-service hold on to this handle to perform encryption/decryption/signing/verifying in a batch mode. The problem i am facing is The ASP.NET web service time-outs' after 20 minutes. This act- i think, ...

SHA1 hashing in SQLite: how?

Working with several DBs in parallel and need to initialize some records with hashed passwords. In MS SQL server there are handy functions that allow to hash on the fly: HashBytes('SHA1', CONVERT(nvarchar(32), N'admin')) Is there is a similar function with SQLite? If not, which is the easiest workaround (such as select from SQL serv...

C# Can't generate initialization vector IV

Hi, I get the following error when I try to create a IV initialization vector for TripleDES encryptor. Please see the code example: TripleDESCryptoServiceProvider tripDES = new TripleDESCryptoServiceProvider(); byte[] key = Encoding.ASCII.GetBytes("SomeKey132123ABC"); byte[] v4 = key; byte[] connectionString = Encoding.ASCII.GetBytes...

assigning / validation of signature using RSA (PKCS 7)

Any suggestions for simple and fast library for assigning / validation of signature using RSA Cryptographic Messaging Operations (PKCS#7)? ...

Client Side CAPI Access

How can I access Microsoft's Crypto API from a client side Web application? More specifically, access user's Windows-MY certificates through a web browser and use them to encrypt data. I've looked at CAPICOM but it is no longer supported by Microsoft. I've also looked into Java's Cryptographic Excention and MSCAPI provider but it does no...

ObjectDisposedException when using extension method on RSAKeyValue

I was trying to write the following simple extension method for RSAKeyValue: public static class RSAKeyValueExtensions { public static string ToXmlString(this RSAKeyValue keyValue) { return keyValue.GetXml().OuterXml; } } However, it seems whenever I use ToXmlString, I get an exception: System.ObjectDisposedExc...

Convert PEM to PPK file format

Is there an inbuilt C# mechanism to convert PEM files to PPK files? (you may guess that Amazon EC2 gives me a PEM file, and I need to use the PPK format for SSH connectivity). ...

How to implement c=m^e mod n for enormous numbers?

Hi, I'm trying to figure out how to implement RSA crypto from scratch (just for the intellectual exercise), and i'm stuck on this point: For encryption, c = me mod n Now, e is normally 65537. m and n are 1024-bit integers (eg 128-byte arrays). This is obviously too big for standard methods. How would you implement this? I've been rea...

CP-ABE and ABE API

Is there any Java or .Net implementation (API) available for Ciphertext-Policy Attribute-Based Encryption or for Attribute-Based Encryption ...

MCRYPT_DEV_RANDOM always the same

I'm using MCRYPT_DEV_RANDOM and MCRYPT_DEV_URANDOM as part of blowfish encryption, but I'm noticing it outputs the same random digit every time. It differs from machine to machine, but it's the same in each machine. Is this normal? Does it affect the strength of the initialization vector (IV) I generate with it? ...

BlackBerry Encryption using AES and Nopadding

Hi, I am new to Blackberry development. I have the following encrypt / decrypt routines and need to port it to my blackberry project. Can you please get me started? Regards import javax.crypto.*; import javax.crypto.spec.*; import java.io.*; import java.util.zip.CRC32; import java.util.zip.Checksum; import java.util.zip.Inflater; im...

Minimal message size public key encryption in .NET

I'd like to encrypt very little data (15 bytes to be exact) into a as short as possible (optimally, no longer than 16 bytes) message using a public key cryptography system. The standard public key system, RSA, unfortunately produces messages as big as its keys, that is about 100 bytes, depending on key size. To make things more difficul...