/[pkg-mixmaster]/trunk/Mix/Src/pgpdata.c
ViewVC logotype

Diff of /trunk/Mix/Src/pgpdata.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 294 by weaselp, Thu Sep 26 22:28:25 2002 UTC revision 295 by weaselp, Tue Oct 1 08:23:20 2002 UTC
# Line 6  Line 6 
6     details.     details.
7    
8     OpenPGP data     OpenPGP data
9     $Id: pgpdata.c,v 1.23 2002/09/26 22:28:25 weaselp Exp $ */     $Id: pgpdata.c,v 1.24 2002/10/01 08:23:20 weaselp Exp $ */
10    
11    
12  #include "mix3.h"  #include "mix3.h"
# Line 974  end: Line 974  end:
974    return (err);    return (err);
975  }  }
976    
977  int pgp_makeseckey(BUFFER *keypacket, BUFFER *outtxt,  int pgp_makekeyheader(int type, BUFFER *keypacket, BUFFER *outtxt,
978                     BUFFER *pass, int keyalgo)                     BUFFER *pass, int keyalgo)
979  {  {
980    BUFFER *p, *pubkey, *seckey, *subkey, *sig, *tmp, *dummy;    BUFFER *p, *pubkey, *seckey, *subkey, *sig, *tmp, *dummy;
981    int type, thisalgo, err = -1;    int thisalgo, err = -1;
982    time_t created;    time_t created;
983    
984      assert(type == PGP_SECKEY || type == PGP_PUBKEY);
985    
986    p = buf_new();    p = buf_new();
987    seckey = buf_new();    seckey = buf_new();
988    pubkey = buf_new();    pubkey = buf_new();
# Line 990  int pgp_makeseckey(BUFFER *keypacket, BU Line 992  int pgp_makeseckey(BUFFER *keypacket, BU
992    dummy = buf_new();    dummy = buf_new();
993    
994    buf_set(seckey, keypacket);    buf_set(seckey, keypacket);
995    type = pgp_getpacket(keypacket, p);    if (type != pgp_getpacket(keypacket, p))
   if (type != PGP_SECKEY)  
996      goto end;      goto end;
997    
998    thisalgo = pgp_makepkpacket(PGP_SECKEY, p, outtxt, tmp, pubkey, pass,    thisalgo = pgp_makepkpacket(type, p, outtxt, tmp, pubkey, pass,
999                                &created);                                &created);
1000    if (thisalgo == -1 || (keyalgo != 0 && keyalgo != thisalgo))    if (thisalgo == -1 || (keyalgo != 0 && keyalgo != thisalgo))
1001      goto end;      goto end;
1002    
1003    while ((type = pgp_getpacket(keypacket, p)) > 0) {    while ((type = pgp_getpacket(keypacket, p)) > 0) {
1004      if (type == PGP_SECSUBKEY) {      if (type == PGP_SECSUBKEY || type == PGP_PUBSUBKEY) {
1005        if (pgp_makepkpacket(PGP_SECSUBKEY, p, outtxt, dummy, subkey, pass,        if (pgp_makepkpacket(type, p, outtxt, dummy, subkey, pass,
1006                             &created) == -1)                             &created) == -1)
1007          goto end;          goto end;
1008        buf_nl(outtxt);        buf_nl(outtxt);

Legend:
Removed from v.294  
changed lines
  Added in v.295

  ViewVC Help
Powered by ViewVC 1.1.5