Rejigger the SSHKey trait a little more cleanly.

This commit is contained in:
2019-04-04 19:51:03 -07:00
parent 68ddc7096b
commit e4f67f0918
4 changed files with 159 additions and 123 deletions

View File

@@ -13,6 +13,7 @@ pub use self::public::*;
use cryptonum::unsigned::*;
use rand::Rng;
use rand::distributions::Standard;
use super::KeyPair;
pub struct DSAKeyPair<P: DSAParameters>
{
@@ -20,6 +21,17 @@ pub struct DSAKeyPair<P: DSAParameters>
pub public: DSAPubKey<P>
}
impl<P: DSAParameters> KeyPair for DSAKeyPair<P>
{
type Private = DSAPrivKey<P>;
type Public = DSAPubKey<P>;
fn new(public: DSAPubKey<P>, private: DSAPrivKey<P>) -> DSAKeyPair<P>
{
DSAKeyPair{ private, public }
}
}
pub trait DSAKeyGeneration
{
type Params;