ncclient SSH transport relies on the paramiko library
Short answer
A Ncclient's SSH transport is implemented with paramiko, while cryptography and pyOpenSSL provide lower-level crypto/TLS functions and socket supplies only the TCP endpoint.
Question
Key Takeaways
ncclient's SSH transport is built on the Paramiko library, which implements SSHv2 negotiation, authentication and the netconf subsystem channel. The correct option is paramiko; cryptography and pyOpenSSL are lower-level crypto or TLS dependencies, and socket only provides the underlying TCP endpoint. NETCONF over SSH therefore depends on paramiko for the protocol layer that ncclient invokes.
Expert Analysis
For a NETCONF-over-SSH session, ncclient's built-in SSH transport is a thin wrapper around Paramiko, so paramiko is the library that supplies the SSH protocol rather than the general-purpose crypto or socket packages listed beside it.
ncclient's SSHSession class binds NETCONF transport to Paramiko's SSHv2 stack
ncclient separates NETCONF message handling from transport, and its standard SSH transport lives in the ncclient.transport.ssh module. The SSHSession class imports Paramiko and creates a paramiko.Transport object to carry the NETCONF session. RFC 6242 defines NETCONF over SSH, including the requirement to open an SSH session channel and request the netconf subsystem; ncclient delegates those operations to Paramiko rather than implementing SSH itself. This is visible in the package's transport code and dependency metadata: paramiko is the SSH client library that ncclient names, while the other choices do not supply the SSH session API that ncclient calls. Paramiko performs the version exchange, algorithm negotiation, key exchange, user authentication, channel multiplexing and subsystem request. ncclient then layers XML RPC encoding, capability exchange and operations such as get-config on top of that channel. The documented rule is therefore straightforward: when a NETCONF client uses SSH as its transport, identify the library that implements SSH for that client. For ncclient, that library is paramiko. The presence of cryptography elsewhere in the environment is an implementation detail of Paramiko, not a change in which library ncclient selects for SSH.
The deciding condition is ncclient's direct paramiko import in the SSH transport layer
The decisive condition is that ncclient's SSH transport directly imports and calls paramiko, while the remaining options are either transitive crypto dependencies or generic networking primitives. cryptography may be installed because Paramiko uses it for cipher, hash and key operations; pyOpenSSL may appear in a Python image for TLS or X.509 work; socket is part of the standard library and is used to obtain a TCP connection. None of those facts makes any of them the SSH library that ncclient uses. In the actual connection path, ncclient's SSHSession constructs paramiko.Transport, authenticates through Paramiko's password or key methods, opens a Paramiko channel and invokes the netconf subsystem on that channel. Those are Paramiko API calls, not cryptography, pyOpenSSL or socket calls. If the transport were built on another SSH backend, the import and the method names inside ncclient.transport.ssh would differ. The decisive test is direct dependency: paramiko is the only option whose role is to provide an SSHv2 client and server implementation. A library being present in the same virtual environment, or participating lower in the stack, is not enough to make it ncclient's SSH transport.
Paramiko, cryptography, pyOpenSSL and socket occupy different layers in the connection
Paramiko, cryptography, pyOpenSSL and socket occupy different layers, and the phrase "SSH library" selects only the first. Paramiko is an SSHv2 protocol implementation: it handles the SSH banner, key exchange, encryption and MAC algorithms, host-key verification, password and public-key authentication, channels and subsystem requests. cryptography is a general-purpose cryptographic toolkit that Paramiko uses for primitives such as AES, RSA, ECDSA and hashing; it does not itself provide an SSH client session. pyOpenSSL is a Python binding around OpenSSL aimed mainly at TLS and X.509 certificate handling, so it belongs to a different secure-transport world than NETCONF over SSH. socket is the operating system's TCP/IP endpoint API; ncclient may use a socket as the byte stream beneath SSH, but a socket has no SSH handshake, authentication or channel concept. In the ncclient call graph, socket sits at the bottom, Paramiko sits above it as the SSH protocol layer, and ncclient's NETCONF RPC layer sits on top. Choosing cryptography or pyOpenSSL describes a dependency or TLS role; choosing socket describes the networking substrate. Only paramiko fills the SSH-library role.
Subsystem invocation is where paramiko takes effect during connection setup
Subsystem invocation is where paramiko takes effect during connection setup. In ncclient's SSH workflow, the client resolves the device address and port, establishes a TCP socket, passes that socket to paramiko.Transport, starts the SSH transport, negotiates algorithms, authenticates the user, opens a session channel and requests the netconf subsystem. Only after the subsystem request succeeds does ncclient send the NETCONF <hello> and begin exchanging XML-encoded RPCs. This ordering matters because the SSH library must be in place before any NETCONF capability or configuration payload is processed. A raw socket would leave the client with an open TCP connection to port 830 but no SSH negotiation, no authentication and no encrypted channel. cryptography or pyOpenSSL would supply primitives or TLS behavior, not an SSH client channel. Paramiko is the component that converts the TCP byte stream into an authenticated, encrypted SSH session and then into the netconf subsystem channel. That is the precise step at which the correct option is load-bearing, and it explains why the other libraries, even when present, cannot substitute for paramiko in ncclient's SSH transport. Without that SSH transport, the NETCONF client would be left with a TCP byte stream that cannot carry the subsystem request or the encrypted RPC exchange.
Official Reference
These links open the official vendor documentation in a new tab.
Exam Strategy
When an item asks which library or protocol stack a Python automation tool uses, separate the direct dependency from transitive packages. Look for the import or transport class that the tool itself calls: ncclient's SSH path names paramiko, so crypto libraries installed underneath it are distractors. Also distinguish the protocol layer from the substrate—socket is TCP, pyOpenSSL is TLS/X.509, and cryptography supplies primitives. Apply the same layer test to Netmiko, requests or RESTCONF questions rather than memorizing a single answer.
Related Analysis
Practice All 300-435 Questions
Access 150 questions with complete answers and detailed explanations.
View Full 300-435 Practice Test →