2

Is it possible to decrypt a file which is encrypted in sql server using 3DES algorithm?

Using java if I encrypt and save to sqlserver, then I am able to decrypt with out issues..

Is there any difference of encryption methods of sqlserver and java?

Frakcool
  • 10,915
  • 9
  • 50
  • 89
Raj
  • 537
  • 4
  • 9
  • 18
  • Why would you want to do that? – apkisbossin Dec 03 '15 at 15:41
  • Thanks for the reply..., as there are already files in sqlserver DB and it is encrypted from the DB side..so i need to decrypt the files and view in java frontend. – Raj Dec 03 '15 at 15:54
  • You don't want to encrypt in the DB because if somebody intercepts the request between the program and the DB, they will have whatever you were trying to encrypt in the DB in plaintext which eliminates the purpose of encrypting. – apkisbossin Dec 03 '15 at 15:58

2 Answers2

2

You'd need to be using the same implementations, keys, lengths, chaining mode, initialization vectors etc. If any of the configuration of the algorithms is different, it will not decrypt successfully, this is by design.

If you're using the same for all of the above, in theory you could decrypt using paper and a pencil. Any different and you're looking at several million years of compute capacity to crack it.

ps: Use AES if you want it to be quicker AND more secure. Triple DES uses (as the name suggests) three passes of regular DES encryption, which is considerably slower than a single pass of the more modern AES encryption.

Jeff Watkins
  • 6,343
  • 16
  • 19
  • Thanks for the quick reply.. iam using the same key and the mode which is used in sql server, but iam not using the encryption certificate of sql server... is this iam missing and i dont know how to use the certificate in java code. – Raj Dec 03 '15 at 15:51
  • Oh, I wasn't expecting a certificate! Is this PGP style encryption where the key and signing etc. are also done asymmetrically? If so, the solution is a little more complex as you'll need to have some kind of certificate chain of trust. – Jeff Watkins Dec 03 '15 at 15:54
  • We have files in sqlserver and these pdf file are encrypted in sqlserver using "TRIPLE_DES ENCRYPTION " and i need to decrypt in java using the same algorithm. – Raj Dec 03 '15 at 16:05
1

You will want to encrypt and decrypt in Java because of ease of use and the security it provides. Also as mentioned before AES is quicker and more secure. Even though triple DES is still in the secure range, it's takes so longer to compute.

apkisbossin
  • 336
  • 1
  • 3
  • 16