Preliminary x.509 support. This is some of the ugliest code I've ever written, but it works. Ish.

This commit is contained in:
2019-02-18 10:54:01 -08:00
parent 4559b80d2f
commit 8d8351e833
33 changed files with 2147 additions and 103 deletions

View File

@@ -20,17 +20,19 @@ pub struct DSAKeyPair<P,L,N>
pub public: DSAPubKey<P,L>
}
pub trait DSAKeyGeneration<P>
pub trait DSAKeyGeneration
{
fn generate<G: Rng>(params: &P, rng: &mut G) -> Self;
type Params;
fn generate<G: Rng>(params: &Self::Params, rng: &mut G) -> Self;
}
macro_rules! generate_dsa_pair {
($ptype: ident, $ltype: ident, $ntype: ident, $nbig: ident) => {
impl DSAKeyGeneration<$ptype> for DSAKeyPair<$ptype,$ltype,$ntype>
where
DSAPrivKey<$ptype,$ntype>: DSAPrivateKey<$ptype,$ltype,$ntype>,
impl DSAKeyGeneration for DSAKeyPair<$ptype,$ltype,$ntype>
{
type Params = $ptype;
fn generate<G: Rng>(params: &$ptype, rng: &mut G) -> Self
{
// 1. N = len(q); L = len(p);