Esempio n. 1
0
 public RsaAgentKey(BigInteger modulus, BigInteger exponent, SshAgent agent, byte[] keyData)
 {
     KeyData        = keyData;
     Agent          = agent;
     _privateKey    = new BigInteger[2];
     _privateKey[0] = modulus;
     _privateKey[1] = exponent;
 }
Esempio n. 2
0
        public SshRequest GetRequest(SshAgent agent, int requestCode)
        {
            if (!_requestMap.ContainsKey(requestCode))
            {
                return(null);
            }

            var requestType = _requestMap[requestCode];
            var request     = Activator.CreateInstance(requestType, agent) as SshRequest;

            System.Diagnostics.Debug.Assert(request is SshRequest);

            return(request as SshRequest);
        }
Esempio n. 3
0
        private void MainWindow_Activated(object sender, EventArgs e)
        {
            _sshAgent = new SshAgent();
            //var test = new TestHelloService();

            //test.ParentHWind = new WindowInteropHelper(GetWindow(this)).Handle;

            //var input = Encoding.UTF8.GetBytes("This is a test string");

            //var data = test.Encrypt(input);

            //System.Diagnostics.Debug.WriteLine($"encrypted data = {Convert.ToString(data)}");

            //var output = test.PromptToDecrypt(data, "Decrypt test data");

            //System.Diagnostics.Debug.WriteLine($"Output data = {Encoding.UTF8.GetString(output)}");
        }
Esempio n. 4
0
        public PeageantWindow(SshAgent agent)
        {
            _wndProcDelegate = PegeantWndProc;

            // Create WNDCLASS
            WndClass windClass = new WndClass();

            windClass.lpszClassName = CLASS_NAME_PAGEANT;
            windClass.lpfnWndProc   = Marshal.GetFunctionPointerForDelegate(_wndProcDelegate);

            var classAtom = RegisterClassW(ref windClass);

            int lastError = Marshal.GetLastWin32Error();

            if (classAtom == 0 && lastError != ERROR_CLASS_ALREADY_EXISTS)
            {
                throw new Exception("Could not register window class");
            }

            // Create window
            _hwnd = CreateWindowExW(
                0,
                CLASS_NAME_PAGEANT,
                CLASS_NAME_PAGEANT,
                0,
                0,
                0,
                0,
                0,
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero,
                IntPtr.Zero
                );
            _agent = agent;
        }
Esempio n. 5
0
 public SshRequestAddIdentity(SshAgent agent)
     : base(SshAgentCode.AddIdentity, agent)
 {
 }
Esempio n. 6
0
 internal SshRequest(int requestCode, SshAgent agent)
 {
     RequestCode = requestCode;
     Agent       = agent;
 }
Esempio n. 7
0
 internal SshRequest(SshAgentCode requestCode, SshAgent agent)
 {
     RequestCode = (int)requestCode;
     Agent       = agent;
 }
Esempio n. 8
0
 public RequestIdentities(SshAgent agent)
 {
     _agent = agent;
 }
Esempio n. 9
0
 public EcdsaAgentKey(string curve, byte[] uncompressedCoords, SshAgent agent, byte[] keyData)
     : base(curve, uncompressedCoords, null)
 {
     KeyData = keyData;
     Agent   = agent;
 }
Esempio n. 10
0
 public ED25519AgentKey(byte[] pk, SshAgent agent, byte[] keyData) : base(pk)
 {
     Agent   = agent;
     KeyData = keyData;
 }
Esempio n. 11
0
 public SshRequestIdentities(SshAgent agent)
     : base(SshAgentCode.RequestIdentities, agent)
 {
 }
Esempio n. 12
0
 public AgentSignature(SshAgent agent, IAgentKey agentKey)
 {
     _agent    = agent;
     _agentKey = agentKey;
 }