Commit Graph

112 Commits

Author SHA1 Message Date
Kevin King fa5537de81 copy PKey using DER encode and decode
test that fields of cloned private and public keys can be accessed
2016-04-10 00:16:31 -04:00
Kevin King 4016edd4de add EVP_PKEY_copy_parameters to FFI
copy EVP_PKEY params in PKey::clone

test that PKey::clone creates a copy
2016-04-06 19:39:50 -04:00
Benjamin Fry 3e5b65b7fa making from_raw() unsafe 2016-03-05 13:43:14 -08:00
Benjamin Fry 3fb2c48c98 added public key material to the constructor 2016-02-28 22:05:19 -08:00
Benjamin Fry 6ebe581308 review fixes, keep raw RSA initiallization private 2016-02-23 20:49:21 -08:00
Benjamin Fry ef95223d26 adding functionality to directly get and set RSA key material 2016-02-17 23:18:42 -08:00
Steven Fackler 627f394d59 Revert "Revert "impl Clone for PKey and X509 by using their 'references' member"" 2016-01-31 20:38:36 +00:00
Steven Fackler 4e58fd10de Fix PKey RSA constructors
`set1` functions bump the object's refcount so we were previously
leaking the RSA object. Split the decode from PEM part out to a method
on RSA and use that in the PKey constructors.

Also make RSA a pointer and actually free it.
2016-01-30 13:12:06 -08:00
Steven Fackler 8ab4b54541 Revert "impl Clone for PKey and X509 by using their 'references' member" 2016-01-28 23:37:27 -08:00
Steven Fackler 7610804c9d Remove unwraps from rsa accessors 2016-01-22 19:10:22 -08:00
Daniel Albert 3ee2bf9310 Fix up RSA integration 2016-01-20 20:29:06 +00:00
Daniel Albert 74db7db560 Merge branch 'master' of https://github.com/sfackler/rust-openssl 2016-01-20 19:59:41 +00:00
Cody P Schafer 3c51f159a7 crypto/pkey: impl Clone for PKey using openssl's ref counting 2016-01-19 22:04:51 -05:00
Daniel Albert 1f45723b39 Fix incorrect unsafe declaration 2016-01-12 20:57:01 +00:00
Daniel Albert 7e8df9febd Adhere to rust conventions 2016-01-12 18:15:07 +00:00
Steven Fackler b32a50797c Merge pull request #328 from Cyberunner23/PemRSA
Add support for RSA PEM files.
2016-01-09 13:08:00 -08:00
Cyberunner23 c0b9a4c8ec Added tests for private_rsa_key_from_pem() and public_rsa_key_from_pem() 2016-01-09 14:36:01 -05:00
Will Tange 89e88727ff Mark PKey as `Send` and `Sync`
Provided that the locking function is set, the underlying `ffi::EVP_KEY`
type should be safe to use across threads.
2016-01-07 06:33:25 +01:00
Cyberunner23 1d3277fbee Added private_rsa_key_from_pem and public_rsa_key_from_pem. 2016-01-05 13:22:56 -05:00
Daniel Albert 578fac7e80 Add public interface to access BigNums from RSA keys 2016-01-01 19:46:03 +00:00
Daniel Albert 5813ca371d Add RSA structs 2016-01-01 19:33:49 +00:00
Steven Fackler 157e6aa961 Rustfmt 2015-12-15 21:51:20 -08:00
Tomoki Aonuma b6647cc610 Put pbkdf2_hmac_{256,512}() behind feature gate
PKCS5_PBKDF2_HMAC is not available with openssl-0.9.8 on os x
2015-12-10 23:00:49 +09:00
Tomoki Aonuma e9b8627af2 Add PBKDF2-HMAC-SHA256 and -SHA512 functions 2015-12-10 20:29:52 +09:00
Overmind JIANG 3c6c4a7b3d Fix a leak when using `EVP_PKEY_get1_RSA`.
`EVP_PKEY_get1_RSA` returns a RSA structure with its reference count
increased by 1 and therefore we need to call `RSA_free` after finishing
using that value.
2015-11-18 11:36:34 +08:00
Steven Fackler f36f610d07 Move HMAC_CTX_copy to sys-extras 2015-11-16 20:16:01 -08:00
Steven Fackler a8a10e64ad Split stuff requiring a shim out to a separate crate 2015-11-16 20:16:01 -08:00
Steven Fackler b0cb0f7c40 Revert "Use AsRef for backwards compatibility with passing IV as Vec"
This reverts commit d2d20a8377.
2015-11-16 20:16:01 -08:00
Thom May 11e3b1b563 Provide public_decrypt, private_encrypt for PKEY 2015-10-28 18:15:55 +00:00
Steven Fackler 81bc1edb61 Merge pull request #284 from bheart/cfb-mode
AES CFB-mode feature
2015-10-12 21:18:27 -04:00
Will Tange acbcb49414 AES CFB{1,8,128} mode support 2015-10-11 20:09:36 +02:00
Nathan Lilienthal ffa9d330fd Add public key PEM read function. 2015-10-01 20:33:12 -04:00
Steven Fackler f4bf55faa3 Merge pull request #270 from mvdnes/crypto_segv
Check if public/private RSA key is properly loaded
2015-09-11 11:31:15 -04:00
Mathijs van de Nes 87d5c0e429 Fix one call to RSA_size found by tests 2015-09-11 09:24:24 +02:00
Mathijs van de Nes 3be32528e5 Add tests to ensure a panic occurs instead of segv 2015-09-11 09:23:51 +02:00
Mathijs van de Nes 0eb2f0ecfa Check rsa.is_null() before passing it to RSA_size
RSA_size will cause an segmentation fault if it is null
2015-09-10 13:04:25 +02:00
Mathijs van de Nes 02b109bf04 Check _fromstr function for success 2015-09-10 12:58:40 +02:00
Alex Gaynor 4781a3304a Make the docs say that load_pub/save_pub methods take DER bytes 2015-09-09 19:58:45 -04:00
Edward Barnard 8067565707 Expose EVP_BytesToKey
This is based on work by pyrho.
Closes #88
2015-08-23 17:08:18 +07:00
Steven Fackler 02dc3eda2f Merge pull request #242 from awelkie/master
Added AES CTR-mode under feature flag.
2015-08-02 22:25:09 -04:00
Andrew Dunham ab7bfad225 Add function to write RSA public key as PEM 2015-07-23 22:30:07 -07:00
Allen Welkie b478c29151 Added AES CTR-mode under feature flag. 2015-07-15 20:45:18 -04:00
Steven Fackler cb7248d8cb Import shim'd HMAC stuff with the original name 2015-06-27 15:23:19 -07:00
Jethro Beekman 2c18bc7f52 Remove superfluous vec! usage 2015-06-14 21:56:48 -07:00
Jethro Beekman d2d20a8377 Use AsRef for backwards compatibility with passing IV as Vec 2015-06-14 21:56:23 -07:00
Jethro Beekman cbf0cbafbf Pass symmetric crypto initialization vector as a slice
Note: This change is backwards-incompatible. Users will need to add turn their
parameters into references.
2015-06-12 18:38:52 -07:00
Emeric Chevalier 7320c1619f Correction on sign and verify documentation to be more explicit of right
behaviour (no hash done by the functions).
2015-05-30 13:08:45 +02:00
Manuel Schölling b0bcb44556 Move PKey comparison func to public_eq() 2015-05-01 10:58:15 +02:00
Manuel Schölling 123d400277 Add comparison for PKeys 2015-04-16 17:14:21 +02:00
Manuel Schölling 7db00b97ba Add X509::public_key() 2015-04-15 22:59:07 +02:00
Manuel Schölling b6c5c113f5 Add SslContext::add_extra_chain_cert() 2015-04-03 14:34:24 +02:00
Manuel Schölling 632d8398cf Add ability to load private keys from files and use raw keys and certificates for SslContext 2015-04-03 14:34:24 +02:00
Alex Crichton 293f1ce5b1 Fixup for beta
Add derive(Clone) and don't negate unsigned numbers
2015-04-02 18:14:51 -07:00
Steven Fackler 19a24b80e9 Fix doctest errors 2015-04-02 11:15:59 -07:00
Steven Fackler 36c90bb205 Fix deprecation warnings 2015-03-25 21:50:21 -07:00
Steven Fackler b406b7c6e6 Fix doc test 2015-03-21 10:00:00 -07:00
Steven Fackler a65b03c89e Fix warnings 2015-03-10 19:38:44 -07:00
Steven Fackler 6991cc6a30 Convert to new IO. 2015-02-24 23:01:57 -08:00
Kevin Butler cb0e1688c8 Update depreciated code 2015-02-20 21:04:01 +00:00
Steven Fackler 2fa1571e2e Remove deprecated functions from openssl-sys 2015-02-13 23:31:00 -08:00
Steven Fackler 6ef819f971 Fix builds against 0.9.x OpenSSL
Namely builds on OSX
2015-02-08 23:31:46 -08:00
Steven Fackler ec65b0c67b Move docs to this repo and auto build 2015-02-07 21:30:05 -08:00