aes

AES (aes-cbc-128, aes-cbc-192, aes-cbc-256) encryption/decryption with openssl C

此生再无相见时 提交于 2019-12-17 08:59:13
问题 I just want to test AES from openSSL with this 3 modes: with 128,192 and 256 key length but my decrypted text is different from my input and I dont know why. Also, when I pass a huge inputs length (lets say 1024 bytes) my program shows core dumped ... My input is always the same but it doesnt matter, at least for now. Heres the code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/aes.h> int main(int argc, char **argv) { int i; int keylength; printf("Give a key

What are best practices for using AES encryption in Android?

久未见 提交于 2019-12-17 08:02:00
问题 Why I ask this question: I know there have been a lot of questions about AES encryption, even for Android. And there are lots of code snippets if you search the Web. But on every single page, in every Stack Overflow question, I find another implementation with major differences. So I created this question to find a "best practice". I hope we can collect a list of the most important requirements and set up an implementation that is really secure! I read about initialization vectors and salts.

What are best practices for using AES encryption in Android?

时光怂恿深爱的人放手 提交于 2019-12-17 07:59:53
问题 Why I ask this question: I know there have been a lot of questions about AES encryption, even for Android. And there are lots of code snippets if you search the Web. But on every single page, in every Stack Overflow question, I find another implementation with major differences. So I created this question to find a "best practice". I hope we can collect a list of the most important requirements and set up an implementation that is really secure! I read about initialization vectors and salts.

Password Verification with PBKDF2 in Java

為{幸葍}努か 提交于 2019-12-17 06:39:20
问题 I'm doing password based file encryption in Java; I'm using AES as the underlying encryption algorithm and PBKDF2WithHmacSHA1 to derive a key from a salt and password combination using the following code (which I got from another generous poster on this site). SecretKeyFactory f = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); KeySpec ks = new PBEKeySpec(password,salt,1024,128); SecretKey s = f.generateSecret(ks); Key k = new SecretKeySpec(s.getEncoded(),"AES"); I share the salt, the

AES interoperability between .Net and iPhone?

眉间皱痕 提交于 2019-12-17 03:53:48
问题 I need to encrypt a string on the iPhone and send it to a .Net web service for decryption. I am able to encrypt/decrypt on the iPhone and with .Net, but the encrypted strings from the iPhone cannot be decrypted by .Net. The error I get is "Padding is invalid and cannot be removed." The .Net code is from: http://blog.realcoderscoding.com/index.php/2008/07/dot-net-encryption-simple-aes-wrapper/ The iPhone code uses the sample code from: http://nootech.wordpress.com/2009/01/17/symmetric

AES encryption in swift

≡放荡痞女 提交于 2019-12-17 03:34:35
问题 I'm trying to implement AES encryption in swift. The encryption decryption for Android and C# is working properly. I need to implement it in swift. It's current code for android and C# is followed by this. I tried to use CryptoSwift Cross platform AES encryption But none of it work. When I send the encrypted string on server it's not been decrypted. Any help will be appreciated 回答1: Be sure to use the same parameters which seem to be AES with CBC mode with iv, PKCS5Padding (actually PKCS#7)

Java AES and using my own Key

試著忘記壹切 提交于 2019-12-17 02:25:39
问题 I want to encrypt a string using AES with my own key. But I'm having trouble with the bit length of the key. Can you review my code and see what I need to fix/change. public static void main(String[] args) throws Exception { String username = "bob@google.org"; String password = "Password1"; String secretID = "BlahBlahBlah"; String SALT2 = "deliciously salty"; // Get the Key byte[] key = (SALT2 + username + password).getBytes(); System.out.println((SALT2 + username + password).getBytes()

How to decrypt file in Java encrypted with openssl command using AES?

自作多情 提交于 2019-12-16 20:02:59
问题 I need to decrypt in JAVA a file encrypted in UNIX with the following command: openssl aes-256-cbc -a -salt -in password.txt -out password.txt.enc mypass mypass I have to decrypt in java as I do here I do in UNIX openssl aes-256-cbc -d -a -in password.txt.enc -out password.txt.new mypass Someone can give me a java code to do this? 回答1: OpenSSL generally uses its own password based key derivation method, specified in EVP_BytesToKey, please see the code below. Furthermore, it implicitly encodes

iOS开发-数据加密算法AES

﹥>﹥吖頭↗ 提交于 2019-12-15 18:58:57
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> iOS开发-数据加密算法AES 分类: iOS开发 2014-11-05 13:43 212人阅读 评论 (0) 收藏 举报 ios 加密 算法 MD5AES 目录 (?) [+] iOS常用加密方法(aes、md5、base64) 1、AES加密 NSData+AES.h文件 // // NSData-AES.h // Smile // // Created by 周 敏 on 12-11-24. // Copyright (c) 2012年 BOX. All rights reserved. // #import <Foundation/Foundation.h> @class NSString; @interface NSData (Encryption) - (NSData *)AES256EncryptWithKey:(NSString *)key; //加密 - (NSData *)AES256DecryptWithKey:(NSString *)key; //解密 @end NSData+AES.m文件 // // NSData-AES.h // Smile // // Created by 周 敏 on 12-11-24. // Copyright (c) 2012年 BOX. All

AES加密解密

核能气质少年 提交于 2019-12-15 18:58:02
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> // // main.m // AES 加密 // // Created by dc008 on 16/1/5. // Copyright © 2016 年 lin. All rights reserved. // // AES 和 MD5 相对比 base64 安全性更高 #import <Foundation/Foundation.h> #import "NSData+AES.h" int main() { NSString *key = @"99" ; // 钥匙 NSString *secret = @" 加密内容 " ; // 准备加密的内容 // 加密 - (NSData *)AES256EncryptWithKey:(NSString *)key NSData *plain = [secret dataUsingEncoding : NSUTF8StringEncoding ]; NSData *cipher = [plain AES256EncryptWithKey :key]; NSLog ( @" 加密后 :%@" ,cipher); NSString *result = [[ NSString alloc ] initWithData :cipher encoding :