encryption

How to encrypt in Java and decrypt in Android and iOS

£可爱£侵袭症+ 提交于 2020-01-12 04:03:25
问题 I have a Linux server running a Java-jar file that encrypts several files. The Android and iPhone App download that file and shall decrypt it. What algorithm I have to use to do so? I recognized that the algorithms I used in Java do not work in Android. What I did in Java was: private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

Small RSA or DSA lib without dependencies

断了今生、忘了曾经 提交于 2020-01-12 03:11:07
问题 Is there a small library for RSA or DSA without any dependencies like GMP or OpenSSL? (Written in C or Asm) 回答1: Take a look at axTLS it's a BSD licensed TLSv1 SSL in C for embedded systems. It's built for POSIX sockets, but is easily ported. The one thing it's missing is RSA key generation, but it can read X.509 certificates. It's about 32KB of code space with a small RAM footprint. 回答2: You may find LibTomCrypt useful. It's written in C, supports RSA and DSA (along with a host of other

What is the best way to implement 2-way encryption with PHP?

强颜欢笑 提交于 2020-01-11 15:50:12
问题 I would like to encrypt the passwords on my site using a 2-way encryption within PHP. I have come across the mcrypt library, but it seems so cumbersome. Anyone know of any other methods that are easier, but yet secure? I do have access to the Zend Framework, so a solution using it would do as well. I actually need the 2-way encryption because my client wants to go into the db and change the password or retrieve it. 回答1: You should store passwords hashed (and properly salted ). There is no

MySql WorkBench AES 256 Decryption

我与影子孤独终老i 提交于 2020-01-11 14:20:15
问题 I have table with: 1) Encrypted_ID varchar (256) 2) Initialization Vector(iv)varchar(256). I would like to decrypt the column value using the key I am using: select Cast(AES_DECRYPT(Encrypted_ID,'Key',InitializationVector_iv)as CHAR ) as DecryptedValue from MyTable; The result is Null. I Also tried: select Cast(AES_DECRYPT(AES_ENCRYPT(Encrypted_ID,'Key',InitializationVector_iv),'Key') as CHAR ) as DecryptedValue from MyTable; The result is blob for few rows. I'm not sure what I'm doing wrong

MySql WorkBench AES 256 Decryption

二次信任 提交于 2020-01-11 14:20:14
问题 I have table with: 1) Encrypted_ID varchar (256) 2) Initialization Vector(iv)varchar(256). I would like to decrypt the column value using the key I am using: select Cast(AES_DECRYPT(Encrypted_ID,'Key',InitializationVector_iv)as CHAR ) as DecryptedValue from MyTable; The result is Null. I Also tried: select Cast(AES_DECRYPT(AES_ENCRYPT(Encrypted_ID,'Key',InitializationVector_iv),'Key') as CHAR ) as DecryptedValue from MyTable; The result is blob for few rows. I'm not sure what I'm doing wrong

Error when connecting to URL - PKIX path building failed

社会主义新天地 提交于 2020-01-11 10:33:12
问题 I am trying to connect to a webpage to gather information, and I am using jsoup to parse the HTML. However, whenever I try to connect to the URL to download the source, I get an error saying something about the PKIX build path. I've looked around, and everything I've found says to add the website's CA Root certificate to my truststore, which I did, but the problem persists (The CA Root cert was already there). I am able to connect to the website through a web browser, but not through a URL

Error when connecting to URL - PKIX path building failed

隐身守侯 提交于 2020-01-11 10:33:06
问题 I am trying to connect to a webpage to gather information, and I am using jsoup to parse the HTML. However, whenever I try to connect to the URL to download the source, I get an error saying something about the PKIX build path. I've looked around, and everything I've found says to add the website's CA Root certificate to my truststore, which I did, but the problem persists (The CA Root cert was already there). I am able to connect to the website through a web browser, but not through a URL

How does RSA work while encrypting a sentence?

寵の児 提交于 2020-01-11 10:00:33
问题 I'm learning about RSA encryption and I have understood how to encrypt a single letter. I have problems understanding how does RSA work while encrypting a sentence. For eg: Single letter encryption: A Encryption= A^e (mod n) But in a sentence. For eg: Sentence encryption: Hello World Does each word get encrypted or does the sentences as a whole get encrypted? 回答1: Neither. In practice RSA is almost always coupled with a symmetric cipher such as AES to encrypt larger ciphertext. RSA in itself

How to prevent a man-in-the-middle attack in case of a compromised server?

混江龙づ霸主 提交于 2020-01-11 09:45:09
问题 Imagine that a server is serving public keys of the users to their partners to make encrypted communication possible. However, the server does NOT have access to the private keys.. Anyway - imagine the server is hacked and it sends not the requested public keys: Alice requests Bob's public key Server sends Eve's public key Bob requests Alice's public key Server sends Eve's public key Alice sends a message to Bob Server unpacks message, reads it and repacks it -> sends to Bob... Bob sends a

How do I decode a BASE64, PCKS-8 representation of a private key in .net?

╄→гoц情女王★ 提交于 2020-01-11 09:44:21
问题 I'm working on integrating my application with the Walmart Marketplace API. Their documentation pretty much says if you don't use Java you're on your own. My application uses VB.Net but I'm open to implementing this in any .net language. From their instructions: Sign the byte array representation of this data by: Decoding the Base 64, PKCS-8 representation of your private key. Note that the key is encoded using PKCS-8. Libraries in various languages offer the ability to specify that the key