Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mysql pads PGP keys with zeros if they are less than 16 characters #177

Open
MarkDDR opened this issue Nov 24, 2013 · 7 comments
Open

Mysql pads PGP keys with zeros if they are less than 16 characters #177

MarkDDR opened this issue Nov 24, 2013 · 7 comments

Comments

@MarkDDR
Copy link
Contributor

MarkDDR commented Nov 24, 2013

Example: CAFEBABE -> CAFEBABE00000000
nil -> 0000000000000000

@alexander-bauer
Copy link
Member

It really shouldn't do that. GPG will interpret this very incorrectly, and try to use the key of id CAFE BABE 0000 0000 rather than xxxx xxxx CAFE BABE. The latter scheme, though 8 digits, is valid, because it's the rightmost 8 digits of the key ID. Even 0000 0000 CAFE BABE is wrong, unfortunately, because then it will interpret that as a 16 character ID.

MySQL makes me very sad.

@MarkDDR
Copy link
Contributor Author

MarkDDR commented Nov 28, 2013

This is expected behaviour in MySQL http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html

There are a couple of solutions to this.

  1. Use VARBINARY instead of BINARY because MySQL doesn't pad VARBINARY with 0x00 on insert.
  2. Detect if there are 8 trailing zero's and automatically strip them

@lukevers
Copy link
Member

Does SQLite3 and everything else we support (I think mariadb also is supported) use VARBINARY? If so, that sounds like a viable option.

@lukevers
Copy link
Member

Upon searching sqlite's site for VARBINARY, I get no response.

No results for: VARBINARY

Upon searching sqlite's site for BINARY, I get a response.

Search results 1..10 of 70 for: BINARY

I only searched for BINARY to make sure that they did have that documentation on their site.

@lukevers
Copy link
Member

Another option is to just use VARCHAR. I'd rather not do anything right now until we get opinions from people.

@dansup
Copy link
Contributor

dansup commented Jan 2, 2014

I'd say VARCHAR.

@alexander-bauer
Copy link
Member

I'm going to check exactly how they're stringified real quick. It's possible that this is more easily fixed in Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants