Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

How Do I ... Serialize DSA Keys

Help
afaucher
2007-05-09
2013-04-23
  • afaucher
    afaucher
    2007-05-09

    I'm implementing a DSA signing scheme using beecrypt and I have my code signing and verifying my blobs but reading though mpnumber.h I don't see how one seralizes an mpnumber in a consistant way.  All I am looking for is a function that takes an mpnumber and fills a constant length buffer (mpnputbin?).  There looks to be more to mpnumber then just length/buffer.

    Any suggestions would be helpful.

    Thanks,
    Alexander Faucher

    Ceton Corporation
    4030 Lake Washington Blvd. NE, Suite 208
    Kirkland, WA 98033

    Web: CetonCorp.com
    Phone: 425.828.0515
    Fax: 206.299.3536

     
    • Bob Deblier
      Bob Deblier
      2007-05-13

      Hi Alexander,

      You can serialize in a consistent way with the functions i2osp and os2ip. If you look at function mpnsetbin, you'll see that it uses os2ip. For examples of using i2osp, you can look inside c++/provider/SHA1withDSASignature.cxx.

      Where do you get the impression that there's more the an mpnumber than length and buffer?

      Sincerely,

      Bob Deblier

       
    • afaucher
      afaucher
      2007-05-14

      I was looking at the mpbarrett which has both modl and mu.  Which seem to both be needed.  Is there a reason all the serialization and functional signing code (SHA1withDSASignature.cxx) is in c++? (besides being a better language)

      I went ahead and wrote my own to/from bytes for both mpnumber and mpbarrett using i2osp and op2ip because I didn't see a function for doing so in the native c portion of the lib.

      Thanks,
      Alexander Faucher

      Web: CetonCorp.com
      Phone: 425.828.0515
      Fax: 206.299.3536