diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-04-26 14:34:36 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-04-29 14:55:56 +0200 |
commit | 1fa018acc90194e1cd1ddf2bd0c6706000a3bc9e (patch) | |
tree | c29ecc4aac1d2d85e1ff08a111d1462b74c6f3e8 /openpgp/src/tpk/mod.rs | |
parent | d53cb0c4df33ebabd1af7e97e8469ed159763a6e (diff) |
openpgp: New TSK type.
- With a1e226f8f1418de43e577fdaa1d087b68bbb09ae in place, we have a
more general way to add components to a TPK. Retire the current
`TSK` type and replace it with a thin shim that only allows
serialization of secret keys.
- Fixes #107.
Diffstat (limited to 'openpgp/src/tpk/mod.rs')
-rw-r--r-- | openpgp/src/tpk/mod.rs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs index 35ed123d..305aa8f8 100644 --- a/openpgp/src/tpk/mod.rs +++ b/openpgp/src/tpk/mod.rs @@ -31,7 +31,6 @@ use { TPK, KeyID, Fingerprint, - TSK, }; use parse::{Parse, PacketParserResult, PacketParser}; use serialize::{Serialize, SerializeInto, SerializeKey}; @@ -42,6 +41,8 @@ mod lexer; mod grammar; mod builder; mod bindings; +mod tsk; +pub use self::tsk::TSK; use self::lexer::Lexer; pub use self::lexer::Token; @@ -2823,10 +2824,13 @@ impl TPK { TPK::from_packet_pile(PacketPile::from(combined)) } - /// Cast the public key into a secret key that allows using the secret - /// parts of the containing keys. - pub fn into_tsk(self) -> TSK { - TSK::from_tpk(self) + /// Derive a [`TSK`] object from this key. + /// + /// This object writes out secret keys during serialization. + /// + /// [`TSK`]: tpk/struct.TSK.html + pub fn as_tsk<'a>(&'a self) -> TSK<'a> { + TSK::new(self) } /// Returns whether at least one of the keys includes a secret |