Commit 7685a834 authored by Mathijs van de Nes's avatar Mathijs van de Nes
Browse files

Switch to the more sane RSA PUBKEY function

For differences, see:
http://openssl.6102.n7.nabble.com/difference-between-i2d-PUBKEY-and-i2d-PublicKey-td43869.html

This will break loading of *public* keys generated before this commit
parent 759feedb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ extern {
    fn EVP_PKEY_get1_RSA(k: *mut EVP_PKEY) -> *mut RSA;
    fn EVP_PKEY_set1_RSA(k: *mut EVP_PKEY, r: *mut RSA) -> c_int;

    fn i2d_RSAPublicKey(k: *mut RSA, buf: *const *mut u8) -> c_int;
    fn d2i_RSAPublicKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA;
    fn i2d_RSA_PUBKEY(k: *mut RSA, buf: *const *mut u8) -> c_int;
    fn d2i_RSA_PUBKEY(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA;
    fn i2d_RSAPrivateKey(k: *mut RSA, buf: *const *mut u8) -> c_int;
    fn d2i_RSAPrivateKey(k: *const *mut RSA, buf: *const *const u8, len: c_uint) -> *mut RSA;

@@ -136,14 +136,14 @@ impl PKey {
     * Returns a serialized form of the public key, suitable for load_pub().
     */
    pub fn save_pub(&self) -> Vec<u8> {
        self._tostr(i2d_RSAPublicKey)
        self._tostr(i2d_RSA_PUBKEY)
    }

    /**
     * Loads a serialized form of the public key, as produced by save_pub().
     */
    pub fn load_pub(&mut self, s: &[u8]) {
        self._fromstr(s, d2i_RSAPublicKey);
        self._fromstr(s, d2i_RSA_PUBKEY);
        self.parts = Public;
    }