Closed simonmitchell closed 6 years ago
Hey Simon - I apologize, but I don't know off the top of my head. I'll need to get some code in front of me at some point in the near future to try and help troubleshoot.
Hi there! Thanks for the quick response 😊 I ended up doing what you did with pkcs7_union_accessors.h
and copy-pasting the code from the c
file in the Crypto
library into my project and all works nicely! Will mark this as closed 😄
Oh awesome! I'm glad that union accessor workaround worked. I couldn't tell if that could be the source of the problem or not, haha. Thanks for following up and closing out the issue with your solution. Hope you have a great day, Simon!
I am having this issue as well. Is there a solution without the need to copy across C code? If not can you please elaborate a bit further on the workaround? Thanks!
Hi @chamitha, I tried to go the route of also importing the headers from where this code has moved to, but couldn’t get that to work! I haven’t been on this project for a while, but will try and get a code example to you soon!
Problem is your Header Search Paths and Library Search Paths
If you add folder OpenSSL to your project, and all files for OpenSSL will be there. Add OpenSSL folder to the top of your Project (not in subfolders)
Click on the project Select the application’s target Select the Build Settings tab Select the All and Combined filters. Add the following values:
$(PROJECT_DIR)/OpenSSL/include - Header Search Paths $(PROJECT_DIR)/OpenSSL/lib - Library Search Paths
https://github.com/openssl/openssl/issues/7538
The c2i functions are considered internal only and were removed from the public API in OpenSSL 1.1.0. You should use the d2i equivalents instead.
Maybe we should use d2i_ASN1_INTEGER
instead of c2i_ASN1_INTEGER
? But apparently, they are not the same, it's really difficult for me to convert the c2i function call into the d2i version.
This was my solution based off of openssl#7538
func DecodeASN1Integer(startOfInt intPointer: inout UnsafePointer<UInt8>?, length: Int) -> Int? {
let integer = d2i_ASN1_UINTEGER(nil, &intPointer, length)
let result = ASN1_INTEGER_get(integer)
ASN1_INTEGER_free(integer)
return result
}
here is an explanation for understanding how it works.
I'm trying to use code similar to this, however with the version of OpenSSL (v1.1.1) that I have compiled myself (Using a similar script to the CocoaPod you use) I get
Use of unresolved identifier c2i_ASN1_INTEGER
. It seems like that file is in theCrypto
framework rather than theOpenSSL
framework, but even if I get that into an importable state it doesn't work 😞I'm very new to cryptography and trying to use OpenSSL, do you have any ideas?