Two versions of the same libraries

I've been given a project previously mantained by another person and I had to install OpenSSL to be able to do various things. OpenSSL has been installed via CocoaPods and it works just fine. The problem is that the project had another library called "Cipher" that it was using to encrypt some info using a 509x certificate. I haven't touched that part of the code, but it now doesn't work anymore. This library contains 4 files: libcrypto.a, libssl.a, oaep.c and oaep.h. The OpenSSL library linked via CocoaPods also contains libcrypto.a and libssl.a.

This is the code that now doesn't work anymore:

- (NSMutableString *)cipherWithBlock: (NSString *)string {
    NSMutableString *cipherBlock = [NSMutableString string];
    static NSString* stringBlock = kLIT_EMPTY;
    stringBlock = string;
    NSData *crt = [[IWUserController sharedInstance] publicKey];
    unsigned char block [DIGEST_BUFFER_SIZE];
    const char* msg = [stringBlock cStringUsingEncoding:[NSString defaultCStringEncoding]];
    cipher((void*)[crt bytes], crt.length, msg, block);
    for (int i = 0; i < DIGEST_BUFFER_SIZE; i++)
        [cipherBlock appendFormat:@"%02X", block[i], nil];
    return cipherBlock;
}

This method actually produces an encripted string, but the web service that is receiving it says that it's not valid. I have no idea what to do. the only thing I know is that the old version with the same exact code, but without OpenSSL, works just fine. Any idea?

Answers


To solve this problem I had to use a forked version of the OpenSSL framework in which the libraries libcrypto.a and libssl.a have been downgraded to the same, modified ones, that the proyect originary used. This way the old encrypting methods and the new ones I've added are working.


Need Your Help

Why GridControl is creating an extra column/space after execution?

wpf devexpress gridcontrol devexpress-windows-ui devexpress-wpf

DevExpress UI controls were used for a Windows Presentation Foundation (or WPF) Application and I am trying to fix/Improve it.