GenerateKeyImage() 개인적인 메소드

private GenerateKeyImage ( Array data, int len ) : int
data Array
len int
리턴 int
예제 #1
0
        public XMRTaskImageResponse XMR_GetImages(BitfiWallet.NOXWS.ImageRequestTable[] requestTable)
        {
            XMRTaskImageResponse taskTransferResponse = new XMRTaskImageResponse();

            try
            {
                List <string> imgList = new List <string>();
                foreach (var tx in requestTable)
                {
                    compute_key_images img = new compute_key_images();
                    img.pub_spendKey_string = MoneroWallet.Converters.ByteArrayToHex(wallet.Keys.SpendPublic);
                    img.sec_spendKey_string = MoneroWallet.Converters.ByteArrayToHex(wallet.Keys.SpendSecret);
                    img.sec_viewKey_string  = MoneroWallet.Converters.ByteArrayToHex(wallet.Keys.ViewSecret);
                    img.tx_pub_key          = tx.TxPubKey;
                    img.out_index           = tx.OutIndex;

                    byte[] abcArr = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(img, ser));
                    var    rrr    = XMRNative.GenerateKeyImage(abcArr, abcArr.Length);
                    byte[] res123 = new byte[rrr];
                    XMRNative.GenerateKeyImageGetData(res123, rrr);
                    var result123 = Encoding.UTF8.GetString(res123);

                    var resp = JsonConvert.DeserializeObject <key_images_response>(result123, ser);
                    if (resp != null && !string.IsNullOrEmpty(resp.retVal))
                    {
                        if (string.IsNullOrEmpty(resp.err_msg))
                        {
                            imgList.Add(resp.retVal);
                        }
                    }
                }


                taskTransferResponse.SpendKeyImages = imgList.ToArray();
                taskTransferResponse.WalletAddress  = wallet.Address;
                taskTransferResponse.Error          = null;

                if (imgList.Count() < 1)
                {
                    taskTransferResponse.Error = "Invalid info or request for key images.";
                }

                return(taskTransferResponse);
            }
            catch (Exception ex)
            {
                taskTransferResponse.Error = ex.Message;
                return(taskTransferResponse);
            }
        }
예제 #2
0
 public key_images_response GetKeyImage(string ViewKey, string PubKey, string Secret, string Txn)
 {
     compute_key_images img = new compute_key_images();
     img.pub_spendKey_string = PubKey;
     img.sec_spendKey_string = Secret;
     img.sec_viewKey_string = ViewKey;
     img.tx_pub_key = Txn;
     byte[] abcArr = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(img, ser));
     var rrr = XMRNative.GenerateKeyImage(abcArr, abcArr.Length);
     byte[] res123 = new byte[rrr];
     XMRNative.GenerateKeyImageGetData(res123, rrr);
     var result123 = Encoding.UTF8.GetString(res123);
     return JsonConvert.DeserializeObject\\(result123, ser);
 }