Beispiel #1
0
 public void ImportParameters(DiffieHellmanParameters ps)
 {
     module      = (ps.Module != null) ? new BigInteger(ps.Module) : 0;
     base_       = (ps.Base != null) ? new BigInteger(ps.Base) : 0;
     privateKeyA = (ps.PrivateKeyA != null) ? new BigInteger(ps.PrivateKeyA) : 0;
     publicKeyA  = (ps.PublicKeyA != null) ? new BigInteger(ps.PublicKeyA) : 0;
     privateKeyB = (ps.PrivateKeyB != null) ? new BigInteger(ps.PrivateKeyB) : 0;
     publicKeyB  = (ps.PublicKeyB != null) ? new BigInteger(ps.PublicKeyB) : 0;
     commonKey   = (ps.CommonKey != null) ? new BigInteger(ps.CommonKey) : 0;
 }
Beispiel #2
0
        public DiffieHellmanParameters ExportParameters()
        {
            DiffieHellmanParameters dh = new DiffieHellmanParameters();

            dh.Module      = module.ToByteArray();
            dh.Base        = base_.ToByteArray();
            dh.PrivateKeyA = privateKeyA.ToByteArray();
            dh.PublicKeyA  = publicKeyA.ToByteArray();
            dh.PrivateKeyB = privateKeyB.ToByteArray();
            dh.PublicKeyB  = publicKeyB.ToByteArray();
            dh.CommonKey   = commonKey.ToByteArray();
            return(dh);
        }