/// <exception cref="System.Exception"></exception> public virtual void SetPubKey(byte[] e, byte[] n) { RSAPublicKeySpec rsaPubKeySpec = new RSAPublicKeySpec(new BigInteger(n), new BigInteger (e)); PublicKey pubKey = keyFactory.GeneratePublic(rsaPubKeySpec); signature.InitVerify(pubKey); }
public override PublicKey GeneratePublic(KeySpec key) { RSAPublicKeySpec spec = (RSAPublicKeySpec)key; RSAParameters dparams = new RSAParameters(); dparams.Modulus = spec.GetModulus().GetBytes(); dparams.Exponent = spec.GetPublicExponent().GetBytes(); return(new RSAPublicKey(dparams)); }