|
|
|
@ -450,6 +450,8 @@ write_seckey_body(const pgp_seckey_t *key,
|
|
|
|
|
(void) fprintf(stderr, "\nturning encryption on...\n");
|
|
|
|
|
}
|
|
|
|
|
pgp_push_enc_crypt(output, &crypted);
|
|
|
|
|
}else{
|
|
|
|
|
pgp_push_sum16_writer(output);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (key->pubkey.alg) {
|
|
|
|
@ -475,12 +477,18 @@ write_seckey_body(const pgp_seckey_t *key,
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!pgp_write(output, key->checkhash, PGP_CHECKHASH_SIZE)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (key->s2k_usage != PGP_S2KU_NONE) {
|
|
|
|
|
|
|
|
|
|
if (!pgp_write(output, key->checkhash, PGP_CHECKHASH_SIZE)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
pgp_writer_pop(output);
|
|
|
|
|
}else{
|
|
|
|
|
uint16_t checksum = pgp_pop_sum16_writer(output);
|
|
|
|
|
if (!pgp_write_scalar(output, checksum, 2)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
@ -757,7 +765,7 @@ pgp_write_struct_seckey_ptag(const pgp_seckey_t *key,
|
|
|
|
|
/* Ref: RFC4880 Section 5.5.3 */
|
|
|
|
|
|
|
|
|
|
/* pubkey, excluding MPIs */
|
|
|
|
|
length += 1 + 4 + 1 + 1;
|
|
|
|
|
length += 1 + 4 + 1;
|
|
|
|
|
|
|
|
|
|
/* s2k usage */
|
|
|
|
|
length += 1;
|
|
|
|
|