For the OpenSSL format it's not enormously useful since there isn't really 
any relevant additional data associated with the key but for formats like 
JWK and PKCS 8 there is a key metadata field that we should expose too.

This is somewhat explained in the tracking issue for key serialisation.


On 31 March 2014 19:42:10 Alex Gaynor <notifications@github.com> wrote:

> > +            else:
> > +                assert errors[0][1] in (
> > +                    self._lib.ERR_LIB_EVP,
> > +                    self._lib.ERR_LIB_PEM,
> > +                    self._lib.ERR_LIB_ASN1,
> > +                )
> > +                raise ValueError("Could not unserialize key data.")
> > +
> > +        evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
> > +
> > +        if password is not None and password_func.called == 0:
> > +            raise TypeError(
> > +                "Password was given but private key is not encrypted.")
> > +
> > +        private_key = self._evp_pkey_to_private_key(evp_pkey)
> > +        return OpenSSLPrivateKey(private_key)
>
> I don't totally understand what the point of wrapping the private key in 
> the `OpenSSLPrivateKey` class is.
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/pyca/cryptography/pull/627/files#r11130164