I'm sending this both to the Keyczar and the Go mailing lists.
In the past week I hacked up a quick proof-of-concept Go
implementation of Keyczar using the Go cryptography libraries as the
backend. It's based mainly on the Python version since it matched
more closely with my view of how I would want to use the library in
Go.
There's still a lot to do in terms of code cleanup, but all the main
functionality should be there. I am able to load all the keys in the
testdata directory and use them for encryption, decryption, signing,
and verification (as appropriate). Key generation is not (yet)
supported. The only outstanding change to my API is making everything
return appropriate error codes. After that, everything else should be
internal: refactorings, checking return values, comments, more test
cases etc.
I'm planning on finishing this work over the holidays and will put
together a more full release "when it's done".
The code is at https://github.com/dgryski/dkeyczar . It's licensed
under Apache 2.0 like the rest of Keyczar.
For the Go folks: Keyczar is a cryptography library from Google housed
at http://www.keyczar.org/
Thanks for a great library and a great language,
Damian
--
You received this message because you are subscribed to the Google Groups "Keyczar Discuss" group.
To post to this group, send email to keyczar...@googlegroups.com.
To unsubscribe from this group, send email to keyczar-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/keyczar-discuss?hl=en.
| Shawn Willden | | Software Engineer | | swil...@google.com | | Commerce Team |
---------- Forwarded message ----------
From: Damian Gryski <d...@pobox.com>
Date: Fri, Dec 16, 2011 at 4:38 PM
Subject: Re: [go-nuts] ANN: Keyczar Go Implementation
To: roger peppe <rogp...@gmail.com>
Cc: keyczar...@googlegroups.com, golan...@googlegroups.com
On Fri, Dec 16, 2011 at 4:13 PM, roger peppe <rogp...@gmail.com> wrote:
> On 16 December 2011 12:47, Damian Gryski <dgr...@gmail.com> wrote:
>> The code is at https://github.com/dgryski/dkeyczar . It's licensed
>> under Apache 2.0 like the rest of Keyczar.
>
> cool.
>
> a few initial reactions (based only on reading
> http://gopkgdoc.appspot.com/pkg/github.com/dgryski/dkeyczar)
> and a 1-second glance at the source.
>
> - documentation! there are no comments on the exported types,
> functions or the package.
No, my late-night hacking was targeted towards functional
completeness first. As I said, this really was a "preview release".
Getting the docs done is certainly on my list and, now that I've
announced the project, probably next up.
> - why bother exporting interfaces? why not just export the keyCzar
> type (you could follow the example of a few other crypto packages
> and just call it "Cipher")
I think because the the key-type you load limits you to certain
functionality, so I wanted to make sure that if you though you were
loading a particular type that you thought you could do something
with, it either errored on load or whatever you were asking it to do
would work.
The other option is to check the key purpose at the start of each
Encrypt/Decrypt/Sign/Verify and immediately return with "Invalid
Purpose" at that point, rather than at object creation time. I
suppose if I just export the Keyczar type, I can probably get both of
these, either by assigning to an object of the type I'm expecting to
use it for. Most of this code was written while sick and generally
after 10pm. It's possible I didn't make the best decisions ... :)
> - following on from the above, it would definitely be worth following
> existing conventions as much as possible (for instance, using
> Encrypt(dst, src []byte)).
> that way your type can potentially be share an interface with existing
> algorithms.
Good idea, I hadn't thought about reusing Keyczar objects with
other Go modules. Although, I'm not sure it makes sense to implement
something like cipher.Block for this. We're not just wrapping a raw
encrypt/decrypt routine, we're adding headers and change the encoding
(web64). We still want the ability to return error objects, which
we've now just lost because Encrypt and Decrypt are assumed not to
fail. However, our methods have more failure modes (invalid encoding,
invalid version, unknown key, ...)
I'll look through some of the Go standard interfaces and see if any
make sense to use here.
Thanks for your input!
Damian
Le vendredi 16 décembre 2011 17:13:31 UTC+1, Shawn Willden a écrit :
I do have one concern, though... are you signing up to be the maintainer of the Keyczar Go implementation?
As an example of the problem, the Python implementation upon which you based your Go implementation is fairly deficient right now. Specifically, it lacks:
- Session encryption (close to being merged; see the python_sessions branch)
- Certificate import
- PKCS#8 private key import/export
- Password-based key encryption
Go is awesome... but we haven't had any requests for it.
- Session encryption (close to being merged; see the python_sessions branch)
- Certificate import
- PKCS#8 private key import/export
- Password-based key encryption
These have now been implemented:
- Session encryption
- Password-based key encryption.
- Importing unencrypted PEM RSA private and public keys
It looks like Go only has partial support for PKCS8 import/export (RSA import only), so I think I'll either need to patch the standard library or wait until somebody else does.
Can you be more specific on what you mean by "Certificate import" ?
It looks like Go only has partial support for PKCS8 import/export (RSA import only), so I think I'll either need to patch the standard library or wait until somebody else does.That's unfortunate. Does it support import of password-protected private keys? Just trying to get a feel for the scope of what's not covered.
Can you be more specific on what you mean by "Certificate import" ?Sure. Import the public key from an X.509 public key certificate into an existing, appropriately-typed Keyczar key set. Arguably we should look at the extended attributes of the cert to figure out what Keyczar purpose to attach, but that's not always unambiguous so for the moment we just require the user to specify during the import.
Le mercredi 21 décembre 2011 00:54:16 UTC+1, Shawn Willden a écrit :That's unfortunate. Does it support import of password-protected private keys? Just trying to get a feel for the scope of what's not covered.I'd have to say "no". There doesn't seem to be anything related to passwords or encryption in the x509 code ( http://tip.golang.org/pkg/crypto/x509/ )
Ok, that sounds pretty straight-forward. The x509 library should handle this easily.
On Tue, Dec 20, 2011 at 5:17 PM, Damian Gryski <dgr...@gmail.com> wrote:Le mercredi 21 décembre 2011 00:54:16 UTC+1, Shawn Willden a écrit :That's unfortunate. Does it support import of password-protected private keys? Just trying to get a feel for the scope of what's not covered.I'd have to say "no". There doesn't seem to be anything related to passwords or encryption in the x509 code ( http://tip.golang.org/pkg/crypto/x509/ )I'm talking about PKCS#8, not X.509.X.509 is a standard that defines the structure and content of public-key certificate files. There's no need for encryption or passwords because they're public keys.PKCS#8 is a standard that defines the structure and content of private key files. They aren't certified, but contain private keys, so it also specifies the an optional mechanism for password-based encryption of the key data, using the PKCS#5 password-based encryption standard.
The only code that deals with PKCS#8 stuff in Go is under the x509 library. It currently defines a single routine that has the header comment// ParsePKCS8PrivateKey parses an unencrypted, PKCS#8 private key. See
Implementing PKCS#5 PBE support wouldn't be terribly difficult, but it's not completely trivial either. Given that, it would then be easy to support encrypted PKCS#8 keys.
For the moment I'm okay with just documenting that the Go implementation doesn't support PKCS#8 import of encrypted private keys or DSA keys.
Damian--
You received this message because you are subscribed to the Google Groups "Keyczar Discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msg/keyczar-discuss/-/_Gvv5uX3dngJ.
To post to this group, send email to keyczar...@googlegroups.com.
To unsubscribe from this group, send email to keyczar-discu...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/keyczar-discuss?hl=en.