using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using org.CyberPlat;

/// <summary>
/// Summary description for WBMobile
/// </summary>
public class WBMobile
{
	public WBMobile()
	{
        //IPriv.Initialize();
		//
		// TODO: Add constructor logic here
		//
	}
    public string GetResponse(string password, string MobileRQ)
    {
        string RS = string.Empty;
        IPrivKey sec = null;
        try
        {
            string path = HttpContext.Current.Server.MapPath("~/App_Data/secret.key");
            sec = IPriv.openSecretKey(path, password);
            RS = sec.signText(MobileRQ);
        }
        catch (IPrivException err)
        {
            RS = err.code.ToString();
            // MessageBox.Show(err.ToString() + " (" + err.code + ")");
        }

        if (sec != null)
        {
            sec.closeKey();
        }
        return RS;
    }
}
