As mentioned on the tracking issue for key serialisation, not all key 
formats are this simple. I'd rather all the serialisation formats shared a 
common style if not an actual interface and so I went with a class instead. 
There is probably scope for adding an actual interface definition here too 
though but I was waiting for more people to start showing interest in this 
issue :-)


On 31 March 2014 21:37:25 Glyph <notifications@github.com> wrote:

> > @@ -0,0 +1,53 @@
> > +.. hazmat::
> > +
> > +Key Serialization
> > +=================
> > +
> > +.. currentmodule:: cryptography.hazmat.primitives.serialization
> > +
> > +There are several common schemes for serializing asymmetric private and 
> public
> > +keys to bytes. They generally support encryption of private keys and 
> additional
> > +key metadata.
> > +
> > +
> > +.. class:: OpenSSLPrivateKey(private_key)
>
> If the *only* attribute this class supports is `private_key`, then does it 
> really need to be a class?  Couldn't there just be a `load_pem` function 
> that returns whatever type that is?
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/pyca/cryptography/pull/627/files#r11135505