Fix rsa openssl mismatch #15

Merged
merged 4 commits into from Mar 20, 2012

Conversation

Projects
None yet
2 participants
Contributor

philips commented Mar 20, 2012

I was trying to compare the output of openssl rsa|dsa in unit tests to the to_pem functions and found a couple of bugs. They were detected when linking luacrypto to certain versions of openssl by the existing unit tests.

Brandon Philips added some commits Mar 8, 2012

x509_cert: add x509_cert to read out pubkey
With this patch we can now do things like verify a x509 cert against a x509_ca
then extract its pubkey and test a message signature.

    cert = crypto.x509_cert()
    cert:from_pem(server_cert)
    kpub = cert:pubkey()
    message = 'Hello world'
    verified = crypto.verify('md5', message, signature, kpub)
docs: add x509_cert and x509_ca
add docs for the x509_cert and x509_ca objects.
pkey: use DSA and RSA PrivateKey functions in to_pem
Detect what type of key we are dealing with and use the right to_pem
function. This way we match the enconding that the openssl dsa|rsa apps
use for certificates.
pkey: to_pem: check return codes
check the return codes of wrote_bio_PrivateKey for any error.

mkottman added a commit that referenced this pull request Mar 20, 2012

@mkottman mkottman merged commit 104d3c8 into mkottman:master Mar 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment