function readPublicKey(keyPaths, kcb) {
			mod_fs.readFile(keyPaths.public,
			    function (kerr, blob) {
				if (kerr) {
					kcb(kerr);
					return;
				}

				try {
					var key = mod_sshpk.parseKey(blob,
					    'ssh', keyPaths.public);
				} catch (e) {
					kcb(e);
					return;
				}

				if (keyPaths.private === undefined) {
					var pubSrc = mod_path.basename(
					    keyPaths.public);
					var kp = new KeyPair(self.krp_kr, {
						plugin: 'homedir',
						source: pubSrc,
						public: key
					    });
					each(kp, kcb, function () {
						skip = true;
						kcb();
					});
					return;
				}

				readPrivateKey(keyPaths, function (pkerr, pk) {
					var src = mod_path.basename(
					    keyPaths.private);
					if (pkerr && pkerr.name ===
					    'KeyEncryptedError') {
						var lkp = new LockedKeyPair(
						    self.krp_kr, {
							plugin: 'homedir',
							source: src,
							public: key,
							privateData: pk,
							privateFormat: 'pem'
						    });
						each(lkp, kcb, function () {
							skip = true;
							kcb();
						});
						return;
					}
					if (pkerr) {
						kcb(pkerr);
						return;
					}

					var kkp = new KeyPair(self.krp_kr, {
						plugin: 'homedir',
						source: src,
						public: key,
						private: pk
					    });
					each(kkp, kcb, function () {
						skip = true;
						kcb();
					});
				}, true);
			});
		}
/*
		 * When we have both a public and private key file, read in the
		 * .pub file first to do the fingerprint match. If that
		 * succeeds, read in and validate that the private key file
		 * matches it.
		 *
		 * This also ensures we fail early and give a sensible error if,
		 * e.g. the specified key is password-protected.
		 */
When we have both a public and private key file, read in the
.pub file first to do the fingerprint match. If that
succeeds, read in and validate that the private key file
matches it.

This also ensures we fail early and give a sensible error if,
e.g. the specified key is password-protected.
When we have both a public and private key file read in the . pub file first to do the fingerprint match . If that succeeds read in and validate that the private key file matches it . This also ensures we fail early and give a sensible error if e . g . the specified key is password - protected .
function readPublicKey(keyPaths, kcb) {
			mod_fs.readFile(keyPaths.public,
			    function (kerr, blob) {
				if (kerr) {
					kcb(kerr);
					return;
				}
				try {
					var key = mod_sshpk.parseKey(blob,
					    'ssh', keyPaths.public);
				} catch (e) {
					kcb(e);
					return;
				}
				if (keyPaths.private === undefined) {
					var pubSrc = mod_path.basename(
					    keyPaths.public);
					var kp = new KeyPair(self.krp_kr, {
						plugin: 'homedir',
						source: pubSrc,
						public: key
					    });
					each(kp, kcb, function () {
						skip = true;
						kcb();
					});
					return;
				}
				readPrivateKey(keyPaths, function (pkerr, pk) {
					var src = mod_path.basename(
					    keyPaths.private);
					if (pkerr && pkerr.name ===
					    'KeyEncryptedError') {
						var lkp = new LockedKeyPair(
						    self.krp_kr, {
							plugin: 'homedir',
							source: src,
							public: key,
							privateData: pk,
							privateFormat: 'pem'
						    });
						each(lkp, kcb, function () {
							skip = true;
							kcb();
						});
						return;
					}
					if (pkerr) {
						kcb(pkerr);
						return;
					}
					var kkp = new KeyPair(self.krp_kr, {
						plugin: 'homedir',
						source: src,
						public: key,
						private: pk
					    });
					each(kkp, kcb, function () {
						skip = true;
						kcb();
					});
				}, true);
			});
		}
function readPublicKey ( keyPaths , kcb ) { mod_fs . readFile ( keyPaths . public , function ( kerr , blob ) { if ( kerr ) { kcb ( kerr ) ; return ; } try { var key = mod_sshpk . parseKey ( blob , 'ssh' , keyPaths . public ) ; } catch ( e ) { kcb ( e ) ; return ; } if ( keyPaths . private === undefined ) { var pubSrc = mod_path . basename ( keyPaths . public ) ; var kp = new KeyPair ( self . krp_kr , { plugin : 'homedir' , source : pubSrc , public : key } ) ; each ( kp , kcb , function ( ) { skip = true ; kcb ( ) ; } ) ; return ; } readPrivateKey ( keyPaths , function ( pkerr , pk ) { var src = mod_path . basename ( keyPaths . private ) ; if ( pkerr && pkerr . name === 'KeyEncryptedError' ) { var lkp = new LockedKeyPair ( self . krp_kr , { plugin : 'homedir' , source : src , public : key , privateData : pk , privateFormat : 'pem' } ) ; each ( lkp , kcb , function ( ) { skip = true ; kcb ( ) ; } ) ; return ; } if ( pkerr ) { kcb ( pkerr ) ; return ; } var kkp = new KeyPair ( self . krp_kr , { plugin : 'homedir' , source : src , public : key , private : pk } ) ; each ( kkp , kcb , function ( ) { skip = true ; kcb ( ) ; } ) ; } , true ) ; } ) ; }
When we have both a public and private key file, read in the
 .pub file first to do the fingerprint match.
When we have both a public and private key file read in the . pub file first to do the fingerprint match .