@@ -17,10 +17,12 @@ use pgp::packet::{
1717 SubpacketData ,
1818} ;
1919use pgp:: ser:: Serialize ;
20+ use pgp:: types:: Timestamp as PgpTimestamp ;
2021use pgp:: types:: { CompressionAlgorithm , KeyDetails , KeyVersion } ;
2122use rand_old:: thread_rng;
2223use tokio:: runtime:: Handle ;
2324
25+ use crate :: config:: Config ;
2426use crate :: context:: Context ;
2527use crate :: events:: EventType ;
2628use crate :: log:: LogExt ;
@@ -147,7 +149,7 @@ pub(crate) fn secret_key_to_public_key(
147149 } ;
148150
149151 Ok ( vec ! [
150- Subpacket :: regular ( SubpacketData :: SignatureCreationTime ( timestamp) ) ?,
152+ Subpacket :: critical ( SubpacketData :: SignatureCreationTime ( timestamp) ) ?,
151153 Subpacket :: regular( SubpacketData :: IssuerFingerprint (
152154 signed_secret_key. fingerprint( ) ,
153155 ) ) ?,
@@ -461,9 +463,16 @@ async fn generate_keypair(context: &Context) -> Result<SignedSecretKey> {
461463 None => {
462464 let start = tools:: Time :: now ( ) ;
463465 info ! ( context, "Generating keypair." ) ;
464- let keypair = Handle :: current ( )
465- . spawn_blocking ( move || crate :: pgp:: create_keypair ( addr) )
466- . await ??;
466+ let keypair = if context. get_config_bool ( Config :: Autocrypt2 ) . await ? {
467+ let now = PgpTimestamp :: now ( ) ;
468+ Handle :: current ( )
469+ . spawn_blocking ( move || crate :: pgp:: autocrypt2:: create_autocrypt2_keypair ( now) )
470+ . await ??
471+ } else {
472+ Handle :: current ( )
473+ . spawn_blocking ( move || crate :: pgp:: create_keypair ( addr) )
474+ . await ??
475+ } ;
467476
468477 store_self_keypair ( context, & keypair) . await ?;
469478 info ! (
0 commit comments