cryptography

Is it possible to use elliptic curve cryptography for encrypting data?

偶尔善良 提交于 2020-01-01 05:10:08
问题 So far I have only seen it used in digital signatures and key agreement protocols. Can it be used like RSA to actually encrypt data? Are there any libraries for this? Edited: I need something like RSA. Encrypt the data with the recievers public key so later he can decyrpt it with his private key. I know ECDH can be used to send a secret value to someone but you don't decide what data is sent. Unlike the "regular" DH with ECDH the resulting secret value is always the same since it only depends

How do I use SHA-512 with Rfc2898DeriveBytes in my salt & hash code?

那年仲夏 提交于 2020-01-01 05:04:08
问题 I'm completely new to cryptography, but learning. I've pieced together many different suggestions from my research online, and have made my own class for handling the hash, salt, key stretching, and comparison/conversion of associated data. After researching the built-in .NET library for cryptography, I discovered that what I have is still only SHA-1. But I'm coming to the conclusion that it's not bad since I'm using multiple iterations of the hash process. Is that correct? But if I wanted to

Brute forcing DES with a weak key

▼魔方 西西 提交于 2020-01-01 04:27:06
问题 I am taking a course on Cryptography and am stuck on an assignment. The instructions are as follows: The plaintext plain6.txt has been encrypted with DES to encrypt6.dat using a 64-bit key given as a string of 8 characters (64 bits of which every 8th bit is ignored), all characters being letters (lower-case or upper-case) and digits (0 to 9). To complete the assignment, send me the encryption key before February 12, 23.59. Note: I expect to get an 8-byte (64-bits) key. Each byte should

Full text search on encrypted data

二次信任 提交于 2020-01-01 04:18:09
问题 Suppose I have a server storing encrypted text (end-to-end: server never sees plain text). I want to be able to do full text search on that text. I know this is tricky, but my idea is to use the traditional full text design ("list" and "match" tables where words are stored and matched with ids from the content table). When users submit the encrypted text, they also send a salted MD5 of the words and respective matches. The salt used is unique for each user and is recovered from their password

Java public private key decryption issue

烂漫一生 提交于 2020-01-01 03:38:05
问题 I am trying to encrypt and decrypt a message as mentioned in the below code. Basically I want to encrypt a message with a public key and convert that encrypted message from byte array to String. And decrypt this string into original text. Here are the both methods. Here encryption works fine but decryption fails (error is "Data must start with zero"). I think this is causing because I convert encrypted byte array into String. How do I solve this? (I want to have encrypted byte array as string

java.security.NoSuchAlgorithmException: RSA Signature not available

橙三吉。 提交于 2020-01-01 03:31:14
问题 this is exception Exception in thread "main" java.security.NoSuchAlgorithmException: RSA Signature not available at java.security.Signature.getInstance(Signature.java:229) at MailClient.main(MailClient.java:52) this is my code import java.io.*; import java.net.*; import java.nio.ByteBuffer; import java.util.*; import java.security.*; public class MailClient { public String getMessage(Mail m){ return m.message; } public static void main(String[] args) throws Exception { // Initialisation

Java and .NET interop on (RSA) signatures

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-01 03:28:10
问题 I'm signing some data on a .net-based smartcard and trying to verify that signature in a java environment - but without success. Smartcard (c#): RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); // In a different method, rsaParams.Exponent and rsaParams.Modulus are set rsaProvider.ImportParameters(rsaParams); // Here I'm importing the key SHA1 sha1 = SHA1.Create(); byte[] signature = rsaProvider.SignData(data, sha1); Client (Java): Signature sig = Signature

AES-128 CBC decryption in Python

心不动则不痛 提交于 2020-01-01 03:27:26
问题 I'm trying to implement this code in python (I'm new to python) and it gives me the following error: AttributeError: 'str' object has no attribute 'decode' If we remove .decode ('hex') only to avoid such error: from itertools import product from Crypto.Cipher import AES import Crypto.Cipher.AES key = ('2b7e151628aed2a6abf7158809cf4f3c').decode('hex') IV = ('000102030405060708090a0b0c0d0e0f').decode('hex') plaintext1 = ('6bc1bee22e409f96e93d7e117393172a').decode('hex') plaintext2 = (

How to generate secret key in Java once and use that key in 2 different programs

。_饼干妹妹 提交于 2019-12-31 18:17:06
问题 My aim is to write a Java program to encrypt a text file ( cipher text ) using AES algorithm . And then, write another program to decrypt that encrypted file ( cipher text ) to get the plain text back. I want to use same key (same key, generate once, save it somewhere, and use it in both encryption and decryption program) for encryption and decryption process. If I generate key and do the encryption and decryption line by line in the same program then it works perfectly. Here is the working

How ciphertext was generated in card reader using DUKPT encryption?

别说谁变了你拦得住时间么 提交于 2019-12-31 10:03:10
问题 For `BDK = "0123456789ABCDEFFEDCBA9876543210"` `KSN = "FFFF9876543210E00008"` The ciphertext generated was below "C25C1D1197D31CAA87285D59A892047426D9182EC11353C051ADD6D0F072A6CB3436560B3071FC1FD11D9F7E74886742D9BEE0CFD1EA1064C213BB55278B2F12"` which I found here. I know this cipher-text is based on BDK and KSN but how this 128 length cipher text was generated? What are steps involved in it or algorithm used for this? Could someone explain in simple steps. I found it hard to understand the