diff --git a/lib/jnpr/junos/utils/scp.py b/lib/jnpr/junos/utils/scp.py
index adc49fd3..8a150d6c 100644
--- a/lib/jnpr/junos/utils/scp.py
+++ b/lib/jnpr/junos/utils/scp.py
@@ -73,11 +73,8 @@ class SCP(object):
 
         .. note:: This method uses the same username/password authentication
                    credentials as used by :class:`jnpr.junos.device.Device`.
-
-        .. warning:: The :class:`jnpr.junos.device.Device` ``ssh_private_key_file``
-                     option is currently **not** supported.
-
-        .. todo:: add support for ``ssh_private_key_file``.
+                   It can also use ``ssh_private_key_file`` option if provided
+                   to the :class:`jnpr.junos.device.Device` 
 
         :returns: SCPClient object
         """
@@ -92,6 +89,7 @@ class SCP(object):
         # through a jumphost.
 
         config = {}
+        kwargs = {}
         ssh_config = getattr(junos, '_sshconf_path')
         if ssh_config:
             config = paramiko.SSHConfig()
@@ -101,6 +99,9 @@ class SCP(object):
         if config.get("proxycommand"):
             sock = paramiko.proxy.ProxyCommand(config.get("proxycommand"))
 
+        if self._junos._ssh_private_key_file is not None:
+            kwargs['key_filename']=self._junos._ssh_private_key_file
+
         self._ssh.connect(hostname=junos._hostname,
                           port=(
                               22, int(
@@ -108,7 +109,7 @@ class SCP(object):
                               junos._hostname == 'localhost'],
                           username=junos._auth_user,
                           password=junos._auth_password,
-                          sock=sock
+                          sock=sock, **kwargs
                           )
         return SCPClient(self._ssh.get_transport(), **scpargs)
 

Support for private key files in scp.py
As noted [here](https://github.com/Juniper/py-junos-eznc/blob/master/lib/jnpr/junos/utils/scp.py#L77), private key files aren't supported. I need this for a project I am working on.

Is it possible to get this fixed?

Cheers,
diff --git a/tests/unit/utils/test_scp.py b/tests/unit/utils/test_scp.py
index c0ddd22e..d72571c8 100644
--- a/tests/unit/utils/test_scp.py
+++ b/tests/unit/utils/test_scp.py
@@ -99,6 +99,22 @@ class TestScp(unittest.TestCase):
         self.assertEqual(mock_scpclient.mock_calls[0][2]['progress'].__name__,
                          '_scp_progress')
 
+    @patch('ncclient.manager.connect')
+    @patch('paramiko.SSHClient.connect')
+    @patch('scp.SCPClient.put')
+    @patch('scp.SCPClient.__init__')
+    def test_ssh_private_key_file(self, mock_scpclient, mock_put,
+                                  mock_sshclient, mock_ncclient):
+        mock_scpclient.return_value = None
+        package = 'test.tgz'
+        dev = Device(host='1.1.1.1', user='user',
+                     ssh_private_key_file='/Users/test/testkey')
+        dev.open(gather_facts=False)
+        with SCP(dev) as scp:
+            scp.put(package)
+        self.assertEqual(mock_sshclient.mock_calls[0][2]['key_filename'],
+                         '/Users/test/testkey')
+
     @contextmanager
     def capture(self, command, *args, **kwargs):
         out, sys.stdout = sys.stdout, StringIO()

pip install -e .[dev]
parse_log_pytest
requirements.txt
coverage mock nose pep8 pyflakes coveralls ntc_templates cryptography==3.2 pytest
apt-get update apt-get install -y gcc
3.7
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
bcrypt==4.2.1
certifi @ file:///croot/certifi_1671487769961/work/certifi
cffi==1.15.1
charset-normalizer==3.4.1
coverage==6.5.0
coveralls==3.3.1
cryptography==44.0.2
docopt==0.6.2
exceptiongroup==1.2.2
future==1.0.0
idna==3.10
importlib-metadata==6.7.0
iniconfig==2.0.0
Jinja2==3.1.6
-e git+https://github.com/Juniper/py-junos-eznc.git@d4629f636b915a02c722f895d11b9f187970a60b#egg=junos_eznc
lxml==5.3.1
MarkupSafe==2.1.5
mock==5.2.0
ncclient==0.6.19
netaddr==1.3.0
nose==1.3.7
ntc_templates==4.0.1
packaging==24.0
paramiko==3.5.1
pep8==1.7.1
pluggy==1.2.0
pycparser==2.21
pyflakes==3.0.1
PyNaCl==1.5.0
pyserial==3.5
pytest==7.4.4
PyYAML==6.0.1
requests==2.31.0
scp==0.15.0
six==1.17.0
textfsm==1.1.3
tomli==2.0.1
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: py-junos-eznc
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - bcrypt==4.2.1
      - cffi==1.15.1
      - charset-normalizer==3.4.1
      - coverage==6.5.0
      - coveralls==3.3.1
      - cryptography==44.0.2
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - future==1.0.0
      - idna==3.10
      - importlib-metadata==6.7.0
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - lxml==5.3.1
      - markupsafe==2.1.5
      - mock==5.2.0
      - ncclient==0.6.19
      - netaddr==1.3.0
      - nose==1.3.7
      - ntc-templates==4.0.1
      - packaging==24.0
      - paramiko==3.5.1
      - pep8==1.7.1
      - pluggy==1.2.0
      - pycparser==2.21
      - pyflakes==3.0.1
      - pynacl==1.5.0
      - pyserial==3.5
      - pytest==7.4.4
      - pyyaml==6.0.1
      - requests==2.31.0
      - scp==0.15.0
      - six==1.17.0
      - textfsm==1.1.3
      - tomli==2.0.1
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/py-junos-eznc

tests/unit/utils/test_scp.py::TestScp::test_ssh_private_key_file
tests/unit/utils/test_scp.py::TestScp::test_scp_proxycommand
tests/unit/utils/test_scp.py::TestScp::test_scp_close tests/unit/utils/test_scp.py::TestScp::test_scp_context tests/unit/utils/test_scp.py::TestScp::test_scp_open tests/unit/utils/test_scp.py::TestScp::test_scp_progress tests/unit/utils/test_scp.py::TestScp::test_scp_progress_true tests/unit/utils/test_scp.py::TestScp::test_scp_user_def_progress tests/unit/utils/test_scp.py::TestScp::test_scp_user_def_progress_args_2
lib/jnpr/junos/utils/scp.py
lib/jnpr/junos/utils/scp.py