Apple's cryptography framework. Contains functions for generating commonly-used hashes and cryptographic functions.
Questions tagged [commoncrypto]
209 questions
1
vote
0 answers
Generating a p12 programmatically in iOS?
It seems most examples of creating a p12 programmatically use OpenSSL.
What other options are there?
I've found WolfSSL, and Chillkat (https://www.example-code.com/objc/pfx_create_from_pem_files.asp)
Any others?
What about sample code for creating…

William GP
- 1,252
- 1
- 14
- 29
1
vote
1 answer
CommonCrypto for Framework in podspec
I am going mad on how could I make this podspec work.
I'm developing a swift framework, CommonCrypto is needed. After many problems to make it work for every for every teams (Cordova, React), this is how CommonCrypto is implemented :
I got an…

Valentin Cousien
- 81
- 9
1
vote
1 answer
How can I make CCCrypt compute AES in another mode?
The signature of one-shot crypto method CCCrypt is this (from CommonCryptor.h):
CCCryptorStatus CCCrypt(
CCOperation op, /* kCCEncrypt, etc. */
CCAlgorithm alg, /* kCCAlgorithmAES128, etc. */
CCOptions options, /*…

Raphael
- 9,779
- 5
- 63
- 94
1
vote
1 answer
AES 128 with CBC In IOS
+ (NSData *)doCipher:(NSData *)dataIn
iv:(NSData *)iv
key:(NSData *)symmetricKey
context:(CCOperation)encryptOrDecrypt // kCCEncrypt or kCCDecrypt
error:(NSError **)error
{
…

Sarath
- 11
- 2
1
vote
1 answer
Decrypting DES with CommonCrypto in Swift 3
I want to decrypt a DES encrypted String with CommonCrypto.
I already imported CommonCrypto with a Bridging Header into my Project.
By try and error I managed to call CCCrypt function and it even returns kCCSuccess.
But after that my result is still…

ndreisg
- 1,119
- 13
- 33
1
vote
1 answer
Create UnsafeMutablePointer in Swift 3
I'm updating from Swift 2 to Swift 3 an app for a client and I'm dealing with commonCrypto (yikes!).
I'm trying to convert a DES encryption function but I don't know hoy to replace this piece of code:
let cryptData: NSMutableData! =…

rmvz3
- 1,133
- 2
- 16
- 27
1
vote
2 answers
Signing data with kSecAttrKeyTypeEC key on iOS
I'm trying to sign data and verify the signature using Elliptic Curve algorithm on iOS. Creating the keys works well enough, but attempting to sign the data returns error -1 - which is very generic.
The keys are created as follows:
publicKeyRef =…

SaltyNuts
- 5,068
- 8
- 48
- 80
1
vote
0 answers
How to generate ECPublic Key from given X component, Y component and curve in iOS?
I am getting X component, Y component and curve values from server. I want to derive server public key from that using openssl or common crypto.
In iOS there is no straight forward API to generate Public Key with a given X,Y & Curve values.
Any help…

Marmik
- 459
- 4
- 10
1
vote
1 answer
build error after adding Commoncrypto file for swift
I added "NSData+CommonCrypto.h" and "NSData+CommonCrypto.m"' for use sha256.
I also add bridging header "chekit-Bridging-Header.h" and I wrote
#import in the file.
In the building setting, I checked the file is added in…

kimpro
- 329
- 1
- 5
- 13
1
vote
1 answer
Swift CommonCrypto Adding Error
module.map create files
Add the following code in the file,
module CommonCrypto [system] {
header "/usr/include/CommonCrypto/CommonCrypto.h"
link "CommonCrypto"
export *
}
Bridging-Header file registration and
Search Paths and File Path…

J. soo
- 35
- 9
1
vote
1 answer
how to generate hash key by predefine phrase and salt value in IOS?
I have some .net code to generate hash key for encryption, i want to that code in iOS but i can't found appropriate solution, If anyone have the proper solution please help me
i add the my .net code and it is working fine, i want to convert that…

rohit Sidpara
- 547
- 2
- 14
1
vote
0 answers
3DES with CBC Swift Encryption
i need to encrypt my data with 3DES in CBC_MODE.
I made easily in PHP language with this code :
//Key for Crypt
$key = '324359ECE67B213FE4342EC143F6EB87324359ECE67B213F';
$key = pack('H*', $key);
//Initial Vector
$iv = '02021105';
//String to…

antira87
- 11
- 5
1
vote
1 answer
CCCrypt decrypting in AES
In my iOS app I have to decrypt data coming from a server. I use CommonCrypto framework and, after several trials, I successfully decrypted with
CCCrypt(kCCDecrypt, // operation
kCCAlgorithmAES128, // Algorithm
…

Giorgio
- 1,973
- 4
- 36
- 51
1
vote
1 answer
How to generate a RSA key in Swift using CommonCrypto?
I need to write a function to generate a new RSA private key natively on OS X and be able to print out prime numbers, modulus, etc. I don't want to use nor store anything in the Keychain, just write a simple command line tool.
It used to be very…

Anubis
- 653
- 1
- 7
- 16
1
vote
1 answer
CCCrypt padding option doesn't seem to affect decryption
I have a string that has been encrypted using Java
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
return cipher.doFinal(text.getBytes());
(Note that in Java, PKCS5Padding is actually…

Will M.
- 1,864
- 17
- 28