':py:obj:`Context.set_passwd_cb` accepts a callable which will be invoked when
a private key is loaded from an encrypted PEM.'

def test_set_passwd_cb(self):

    passphrase = b('foobar')
    pemFile = self._write_encrypted_pem(passphrase)
    calledWith = []
    def passphraseCallback(maxlen, verify, extra):
        calledWith.append((maxlen, verify, extra))
        return passphrase
    context = Context(TLSv1_METHOD)
    context.set_passwd_cb(passphraseCallback)
    context.use_privatekey_file(pemFile)
    self.assertTrue(len(calledWith), 1)
    self.assertTrue(isinstance(calledWith[0][0], int))
    self.assertTrue(isinstance(calledWith[0][1], int))
    self.assertEqual(calledWith[0][2], None)
