Skip to content

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

Description

@MarkDDR

Example: CAFEBABE -> CAFEBABE00000000
nil -> 0000000000000000

Activity

  1. alexander-bauer commented on Nov 24, 2013

    @alexander-bauer
    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.

  2. MarkDDR commented on Nov 28, 2013

    @MarkDDR
    ContributorAuthor

    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
  3. lukevers commented on Nov 28, 2013

    @lukevers
    Member

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

  4. lukevers commented on Nov 28, 2013

    @lukevers
    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.

  5. lukevers commented on Nov 28, 2013

    @lukevers
    Member

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

  6. dansup commented on Jan 2, 2014

    @dansup
    Contributor

    I'd say VARCHAR.

  7. alexander-bauer commented on Jan 3, 2014

    @alexander-bauer
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions