public Rsa(Cert cert) { init(cert); }
void init(Cert cert) { this.cert = (Cert)cert.Clone(); this.data = null; }
void init(byte[] data) { this.data = (byte[])data.Clone(); this.cert = null; }
void init(Cert cert) { PemReader pem = new PemReader(new StringReader(cert.PublicKey.GetString_Ascii())); key = (AsymmetricKeyParameter)pem.ReadObject(); }
public RsaInner(Cert cert) { init(cert); }
public static WpcPacket ParsePacket(string recvStr) { List <WpcEntry> o = WpcEntry.ParseDataEntry(recvStr); WpcEntry e; try { e = WpcEntry.FindEntry(o, "PACK"); if (e != null) { byte[] hash = Secure.HashSHA1(e.Data); Pack pack = null; pack = Pack.CreateFromBuf(new Buf(e.Data)); e = WpcEntry.FindEntry(o, "HASH"); if (e != null) { byte[] hash2 = e.Data; if (Util.CompareByte(hash, hash2)) { e = WpcEntry.FindEntry(o, "CERT"); if (e != null) { Cert cert; try { cert = new Cert(e.Data); } catch { return(null); } e = WpcEntry.FindEntry(o, "SIGN"); if (e != null) { byte[] sign = e.Data; if (cert.RsaPublicKey.VerifyData(hash2, sign)) { return(new WpcPacket(pack, hash2, cert, sign)); } } } else { return(new WpcPacket(pack, hash2)); } } } } } catch (OverflowException) { return(null); } return(null); }
public void SetResponse(Pack pack, Cert cert, Rsa key) { responsePack = pack; responseCert = cert; responseKey = key; }