commoncrypto

implementing AES256 encryption into IOS

大憨熊 提交于 2019-12-21 02:47:25
问题 This is my java code. Now I want to implement same functionality in Objective-C. Cipher encryptCipher; IvParameterSpec iv = new IvParameterSpec(key); SecretKeySpec skeySpec = new SecretKeySpec(key, "AES"); encryptCipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); encryptCipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); byte[] encrypted = encryptCipher.doFinal(dataToEncrypt.getBytes()); Log.d("TAG", "encrypted string:" + Base64.encodeToString(encrypted, Base64.DEFAULT)); return Base64

Support of AES 256 with GCM not possible in iOS? [duplicate]

丶灬走出姿态 提交于 2019-12-20 07:35:20
问题 This question already has answers here : Is it possible to use AES128 with GCM mode on iOS? (3 answers) Closed 3 years ago . Currently the encryption mode supported with AES 256 is CBC . But I want to use AES 256 encryption with GCM mode along with PKCS5Padding / PKCS7Padding . Do let me know how it can be done ? 回答1: Common Crypto does not support GCM. But there is an implementation of AES GCM in the Security.framework, and you can add your own header file to use it. However associated data

Support of AES 256 with GCM not possible in iOS? [duplicate]

梦想与她 提交于 2019-12-20 07:35:06
问题 This question already has answers here : Is it possible to use AES128 with GCM mode on iOS? (3 answers) Closed 3 years ago . Currently the encryption mode supported with AES 256 is CBC . But I want to use AES 256 encryption with GCM mode along with PKCS5Padding / PKCS7Padding . Do let me know how it can be done ? 回答1: Common Crypto does not support GCM. But there is an implementation of AES GCM in the Security.framework, and you can add your own header file to use it. However associated data

How can I use a PKCS8 RSA DER Private Key in iOS?

纵然是瞬间 提交于 2019-12-19 09:46:53
问题 At run time, my iOS application receives a file with a public-private RSA key-pair, generated by someone else's Java: KeyPairGenerator keygenerator; keygenerator = KeyPairGenerator.getInstance("RSA"); keygenerator.initialize(4096); KeyPair keypair = keygenerator.generateKeyPair(); PrivateKey privateKey = keypair.getPrivate().getEncoded(); PublicKey publicKey = keypair.getPublic().getEncoded(); I have successfully read and used the public key, using this method, which strips some preamble from

Using CommonCrypto with an IV but always returning nil

╄→尐↘猪︶ㄣ 提交于 2019-12-18 09:49:37
问题 I am using the CommonCrypto CCCryptorCreate to decrypt a message. I am using a password and an IV but it always returns nil. If I use the CCCryptorCreate to decrypt, but don't use an IV on during encryption on the RUBY side and don't use the IV on the obj-c decrypt side then decryption works perfectly and I can see the message. But if I use an IV on the RUBY and IV on the obj-c side decryption ends with a nil message object. I am using this Encrypt in Objective-C / Decrypt in Ruby using

Where can I get CommonCrypto / CommonCrypto file from?

我的未来我决定 提交于 2019-12-18 07:01:23
问题 I have a problem with importing CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest . I need a SHA256 for my Swift code. I found CommonCrypto github site in Cocoapods. https://github.com/AlanQuatermain/aqtoolkit So I have downloaded the file from above. But I'm getting errors about ARC (I have added Bridging-Header like other tutorials do.) The header file's name is NSData+CommonCrypto.h and NSData+CommonCrypto.m . It's not a CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest Where can

Where can I get CommonCrypto / CommonCrypto file from?

被刻印的时光 ゝ 提交于 2019-12-18 07:01:09
问题 I have a problem with importing CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest . I need a SHA256 for my Swift code. I found CommonCrypto github site in Cocoapods. https://github.com/AlanQuatermain/aqtoolkit So I have downloaded the file from above. But I'm getting errors about ARC (I have added Bridging-Header like other tutorials do.) The header file's name is NSData+CommonCrypto.h and NSData+CommonCrypto.m . It's not a CommonCrypto/CommonCrypto or CommonCrypto/CommonDigest Where can

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)

CommonHMAC in Swift

别说谁变了你拦得住时间么 提交于 2019-12-17 02:29:23
问题 I'm trying to create a HMAC SHA-1 hash of a string in Swift but can't figure out how to interact with the APIs as it doesn't seem to be importing the CommonCrypto framework. I've tried various different forms of "import CommonCrypto" and creating a bridging header file but none of it made a difference. The odd thing is that if I create an Objective-C class, I'm able to interact with APIs without any problems, so this seems to be unique to Swift. Also if anyone could tell me what the

How to compile and use CommonCrypto for iOS 4?

大憨熊 提交于 2019-12-13 20:31:12
问题 Since CCKeyDerivationPBKDF is not available until after iOS 5.0, people have suggested using the open source code for CommonCrypto available here: http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/ My question is - how does one use this open source code in an existing project? Should we create dylib and somehow include it in the project or take the source code files and add them to the existing project? How do you do it in Xcode? How do you make sure that at run-time on