vapor / open-crypto

🔑 Hashing (BCrypt, SHA2, HMAC), encryption (AES), public-key (RSA), and random data generation.
MIT License
134 stars 34 forks source link

Add private/public key parsing for using with RSA #42

Closed Andrewangeta closed 6 years ago

Andrewangeta commented 6 years ago

A convenience parser to make a pub/priv keyhole digestible by RSA alg.

Essentially transforming this "-----BEGIN PRIVATE KEY-----\nQklCTElPR1JBUEhZ==\n-----END PRIVATE KEY-----\n"

Into this QklCTElPR1JBUEhZ

Then base64 decoded into this BIBLIOGRAPHY

vzsg commented 6 years ago

Parsing a PEM-encoded private key is not that simple, as the private key data is wrapped in an ASN.1 structure. But sure, having this feature would be definitely helpful.

Andrewangeta commented 6 years ago

@vzsg Is that you making an offer 🌚

vzsg commented 6 years ago

I've already implemented it with OpenSSL a few times for Vapor 2, but I don't have the slightest idea how to do it with AppleTLS 🤥

So this is just me acting smarta$$y.

0xTim commented 6 years ago

The SwiftNIO stuff may change things, looks like it brings back OpenSSL

vzsg commented 6 years ago

Yeah, their support module pulls in LibreSSL on macOS and regular OpenSSL on Linux. That's not necessarily a bad thing :)

tanner0101 commented 6 years ago

This will be fixed in RC.2. Thanks @Andrewangeta