示例#1
0
 public void ImportParameters(RsaParameters ps)
 {
     if (ps.Module != null)
     {
         k = ps.Module.Length;
         if (ps.P != null)
         {
             p = new BigInteger(ps.P);
         }
         if (ps.Q != null)
         {
             q = new BigInteger(ps.Q);
         }
         if (ps.Module != null)
         {
             n = new BigInteger(ps.Module);
         }
         if (ps.Exponent != null)
         {
             e = new BigInteger(ps.Exponent);
         }
         if (ps.D != null)
         {
             d = new BigInteger(ps.D);
         }
     }
 }
示例#2
0
        public RsaParameters ExportParameters()
        {
            RsaParameters ps = new RsaParameters();

            ps.P        = p.ToByteArray();
            ps.Q        = q.ToByteArray();
            ps.Module   = n.ToByteArray();
            ps.Exponent = e.ToByteArray();
            ps.D        = d.ToByteArray();
            return(ps);
        }