not sure how much PHP you know, but I'm using the Hex2Bin function for OpenSSL's RSA functioning, more specifically RSA_Verify which requests a binary form of the signature.
This is the PHP version of the hex2bin function that I have, and what is generating the correct output
Ok, got a better description from another website. I'm dealing with x509 certificates, and during the verification process of the certificate's signature for openSSL, the hexadecimal signature needs to be converted to a byte array, that's what the hex2bin function does.
I have another update, maybe it can be solvable this time. It appears that the issue lies in the way that the string is stored when it hits an 0x00/0x20 case. apparently the 0x00 is being treated as a white space 0x20, as well as the 0x20, when I need it to come out as the pure ASCII form, which has it in some weird looking vertical rectangle, which is throwing off the binary signature. I want to try to avoid using a Replace on 0x20 to 0x00 because if the case does come along where 0x20 is valid, it would invalidate it.
So, my question apparently has now switched to how can I keep 0x00 in my string using the above code, or would it just be better to try to use a "table" swap method IE:
If anyone knows, that would be great, I do however need to keep the data in either std::string, const char *, or unsigned char * format, or be able to convert to it keeping the 0x00 intact.