public T Decrypt <T>(PhantasmaKeys privateKey) { var curve = this.Curve.GetCurve(); var pubBytes = ECDsaSignature.ExtractPublicKeyFromAddress(this.Address); var publicKey = ECC.ECPoint.DecodePoint(pubBytes, curve); return(Decrypt <T>(this.Payload, privateKey, publicKey)); }
public static SharedSecret Encrypt <T>(T message, PhantasmaKeys privateKey, Address publicAddress, ECDsaCurve curve) { var ecdCurve = curve.GetCurve(); var pubBytes = ECDsaSignature.ExtractPublicKeyFromAddress(publicAddress); var publicKey = ECC.ECPoint.DecodePoint(pubBytes, ecdCurve); var secret = GetSharedSecret(privateKey, publicKey); var payload = Encrypt(message, secret); return(new SharedSecret(curve, publicAddress, payload)); }