Apple's cryptography framework. Contains functions for generating commonly-used hashes and cryptographic functions.
Questions tagged [commoncrypto]
209 questions
0
votes
1 answer
Decrypting CommonCrypto encrypted Base 64 encoded string in Java (AES/CBC/PKCS7Padding)
I am trying to decrypt a String with a known key in Java using standard Cipher API.
The encrypted String comes from a Web Service using the standard CommonCrypto Library which responds with some statistics as encrypted strings at regular…

javanewbie
- 3
- 2
0
votes
1 answer
cccrypt is generating strange output in swift 4
I trying to write an encryption (AESCBC256) function based on CCCrypt and the CCCrypt is generating a random value.
for example, when I pass 1234567 to function it'll return "HlFP2rCmycZS1269Cm47Q==" or "TTuSJrBcsOmOCDHc5IQ8Dw==" for the same iv and…
0
votes
1 answer
Public key generated on iOS device invalid on Java server
I have an issue with a SecKeyRef generated on iOS device - when trying to use it on Java server, the exception is thrown:
InvalidKeyException: EC domain parameters must be encoded in the algorithm identifier
here's the code snippet from the…

mag_zbc
- 6,801
- 14
- 40
- 62
0
votes
1 answer
SecKeyEncrypt returns errSecParam
I am trying to encrypt some NSData using SecKeyEncrypt function. The problem is, it returns an error -50, which according to documentation is
errSecParam
One or more parameters passed to the function are not valid.
The problem is, I can't find…

mag_zbc
- 6,801
- 14
- 40
- 62
0
votes
1 answer
Swift: use CommonCrypto with bridging header - unresolved identifier
I am trying to use Cryptor in Swift for iOS.
Random.swift contains the line import CommonCrypto which doesn't work for me. Somewhere I've read that CommonCrypto doesn't offer access to Swift classes so I created a bridging header.
The import still…

user2330482
- 1,053
- 2
- 11
- 19
0
votes
0 answers
AES 256 CTR decrypt in Swift
I tried implement AES 256 CTR mode for decrypt files in Swift 4 with IDZSwiftCommonCrypto CommonCrypto's wrapper. The problem is that I get 'unimplemented' as return status, despite it looks like this mode is implemented in CommonCrypto.
import…

alessionossa
- 923
- 2
- 15
- 41
0
votes
1 answer
How to build commons-crypto package in Ubuntu?
I have cloned the commons-crypto code from https://github.com/apache/commons-crypto.
I want to know the build steps for this packages. Please let me know the all dependency for this package.

santan kumar
- 1
- 3
0
votes
1 answer
Can AES decryption process be saved and restore later?
I need to decrypt a AES encrypted file while downloading it.
That means, every time I receive 256 bytes of data, I could decrypt it right away.
The problem is, users may pause the download process, and restore it later.
Then, a new CCCryptorRef…

SomeHowWhite
- 931
- 1
- 6
- 9
0
votes
2 answers
CCCryptorCreateWithMode ignores padding parameter
I'm trying to use CommonCrypto for crypting with AES-CTR and PKCS7 padding.
I am aware that CTR does not need padding in order to work correctly, there are uses for padding beyond that. Quoting RFC 3686:
For this reason, AES-CTR does not require…

Raphael
- 9,779
- 5
- 63
- 94
0
votes
1 answer
Testing my MD5 Swift 3 code
I have some code to generate MD5 String from file data:
extension Data {
func hexString() -> String {
let string = self.map{ String($0, radix:16) }.joined()
// "45769ca7ec1ac00cec11df87df982b7d"
return string
}
func MD5() -> Data {
…

Lee Probert
- 10,308
- 8
- 43
- 70
0
votes
1 answer
HMAC SHA512 using CommonCrypto in Swift 3.1
I'm trying to encrypt data to send to the API.
The API requires the data to be sent as hmac_sha512 encrypted hash.
I've found various examples of how it possibly could have been done for sha1 and others (not sha512) and also in older versions of…

Nabeel Khan
- 3,715
- 2
- 24
- 37
0
votes
1 answer
aes 128 message decryption -- Swift, iOS
I'm trying to decrypt message with 128 key with following code. This is an extension for String:
func aesDecrypt(key:String, iv:String, options:Int = kCCOptionPKCS7Padding) -> String? {
if let keyData =…

Anton Kashpor
- 1,255
- 2
- 18
- 34
0
votes
2 answers
Xcode C++ MD5 hash
I would like to hash a simple string using MD5 in Xcode c++. I searched a lot but I couldn't find a tutorial. I have to #import . Is that all? How can I call MD5 after that?
I have found this code but it gives me an…

Tom
- 13
- 3
0
votes
1 answer
Import CommmonCrypto library to Swift project
I am using CommonCrypto library in my swift class:
import CommonCrypto
It is working and when I am building my project in Xcode it's ok. I have uploaded my code to repository using git. When I clone this code and try build archive with…

Libor Zapletal
- 13,752
- 20
- 95
- 182
0
votes
1 answer
Authentication error attempting to sign data with EC private key from Secure Enclave
I'm attempting to do the following in my iOS application:
Generate a key pair using SecKeyGeneratePair, storing the private key in the Secure Enclave
Sign some data using the private key
It works if I hang on to the private key reference when keys…

SaltyNuts
- 5,068
- 8
- 48
- 80