当前位置: 首页>>代码示例>>C++>>正文


C++ password函数代码示例

本文整理汇总了C++中password函数的典型用法代码示例。如果您正苦于以下问题:C++ password函数的具体用法?C++ password怎么用?C++ password使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了password函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: username

fbstring Uri::authority() const {
  fbstring result;

  // Port is 5 characters max and we have up to 3 delimiters.
  result.reserve(host().size() + username().size() + password().size() + 8);

  if (!username().empty() || !password().empty()) {
    result.append(username());

    if (!password().empty()) {
      result.push_back(':');
      result.append(password());
    }

    result.push_back('@');
  }

  result.append(host());

  if (port() != 0) {
    result.push_back(':');
    toAppend(port(), &result);
  }

  return result;
}
开发者ID:191919,项目名称:folly,代码行数:26,代码来源:Uri.cpp

示例2: strncpy

char const* Authenticator::computeDigestResponse(char const* cmd,
						 char const* url) const {
  // The "response" field is computed as:
  //    md5(md5(<username>:<realm>:<password>):<nonce>:md5(<cmd>:<url>))
  // or, if "fPasswordIsMD5" is True:
  //    md5(<password>:<nonce>:md5(<cmd>:<url>))
  char ha1Buf[33];
  if (fPasswordIsMD5) {
    strncpy(ha1Buf, password(), 32);
    ha1Buf[32] = '\0'; // just in case
  } else {
    unsigned const ha1DataLen = strlen(username()) + 1
      + strlen(realm()) + 1 + strlen(password());
    unsigned char* ha1Data = new unsigned char[ha1DataLen+1];
    sprintf((char*)ha1Data, "%s:%s:%s", username(), realm(), password());
    our_MD5Data(ha1Data, ha1DataLen, ha1Buf);
    delete[] ha1Data;
  }

  unsigned const ha2DataLen = strlen(cmd) + 1 + strlen(url);
  unsigned char* ha2Data = new unsigned char[ha2DataLen+1];
  sprintf((char*)ha2Data, "%s:%s", cmd, url);
  char ha2Buf[33];
  our_MD5Data(ha2Data, ha2DataLen, ha2Buf);
  delete[] ha2Data;

  unsigned const digestDataLen
    = 32 + 1 + strlen(nonce()) + 1 + 32;
  unsigned char* digestData = new unsigned char[digestDataLen+1];
  sprintf((char*)digestData, "%s:%s:%s",
          ha1Buf, nonce(), ha2Buf);
  char const* result = our_MD5Data(digestData, digestDataLen, NULL);
  delete[] digestData;
  return result;
}
开发者ID:Azzuro,项目名称:MediaPortal-1,代码行数:35,代码来源:DigestAuthentication.cpp

示例3: password

QVariantMap NetworkManager::Security8021xSetting::secretsToMap() const
{
    QVariantMap secrets;

    if (!password().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD), password());
    }

    if (!passwordRaw().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PASSWORD_RAW), passwordRaw());
    }

    if (!privateKeyPassword().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD), privateKeyPassword());
    }

    if (!phase2PrivateKeyPassword().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD), phase2PrivateKeyPassword());
    }

    if (!pin().isEmpty()) {
        secrets.insert(QLatin1String(NM_SETTING_802_1X_PIN), pin());
    }

    return secrets;
}
开发者ID:KDE,项目名称:networkmanager-qt,代码行数:26,代码来源:security8021xsetting.cpp

示例4: realm

QXmppSaslServer::Response QXmppSaslServerDigestMd5::respond(const QByteArray &request, QByteArray &response)
{
    if (m_step == 0) {
        QMap<QByteArray, QByteArray> output;
        output["nonce"] = m_nonce;
        if (!realm().isEmpty())
            output["realm"] = realm().toUtf8();
        output["qop"] = "auth";
        output["charset"] = "utf-8";
        output["algorithm"] = "md5-sess";

        m_step++;
        response = QXmppSaslDigestMd5::serializeMessage(output);
        return Challenge;
    } else if (m_step == 1) {
        const QMap<QByteArray, QByteArray> input = QXmppSaslDigestMd5::parseMessage(request);
        const QByteArray realm = input.value("realm");
        const QByteArray digestUri = input.value("digest-uri");

        if (input.value("qop") != "auth") {
            warning("QXmppSaslServerDigestMd5 : Invalid quality of protection");
            return Failed;
        }

        setUsername(QString::fromUtf8(input.value("username")));
        if (password().isEmpty() && passwordDigest().isEmpty())
            return InputNeeded;

        m_nc = input.value("nc");
        m_cnonce = input.value("cnonce");
        if (!password().isEmpty()) {
            m_secret = QCryptographicHash::hash(
                username().toUtf8() + ":" + realm + ":" + password().toUtf8(),
                QCryptographicHash::Md5);
        } else {
            m_secret = passwordDigest();
        }

        if (input.value("response") != calculateDigest("AUTHENTICATE", digestUri, m_secret, m_nonce, m_cnonce, m_nc))
            return Failed;

        QMap<QByteArray, QByteArray> output;
        output["rspauth"] = calculateDigest(QByteArray(), digestUri, m_secret, m_nonce, m_cnonce, m_nc);

        m_step++;
        response = QXmppSaslDigestMd5::serializeMessage(output);
        return Challenge;
    } else if (m_step == 2) {
        m_step++;
        response = QByteArray();
        return Succeeded;
    } else {
        warning("QXmppSaslServerDigestMd5 : Invalid step");
        return Failed;
    }
}
开发者ID:Lerentis,项目名称:qxmpp,代码行数:56,代码来源:QXmppSasl.cpp

示例5: username

Boolean Authenticator::operator<(const Authenticator* rightSide) {
  // Returns True if "rightSide" is 'newer' than us:
  if (rightSide != NULL && rightSide != this &&
      (rightSide->realm() != NULL || rightSide->nonce() != NULL ||
       username() == NULL || password() == NULL ||
       strcmp(rightSide->username(), username()) != 0 ||
       strcmp(rightSide->password(), password()) != 0)) {
    return True;
  }

  return False;
}
开发者ID:Azzuro,项目名称:MediaPortal-1,代码行数:12,代码来源:DigestAuthentication.cpp

示例6: sendMessage

bool KMSmtpClient::login()
{
    //Check out state.
    if((!isConnected()) && (!connectToHost()))
    {
        //Means socket is still not connected to server or already login.
        return false;
    }
    //Check auth method.
    if(authMethod()==AuthPlain)
    {
        //Sending command: AUTH PLAIN base64('\0' + username + '\0' + password)
        sendMessage("AUTH PLAIN " + QByteArray().append((char)0x00)
                    .append(userName()).append((char)0x00)
                    .append(password()).toBase64());
        // The response code needs to be 235.
        if(!waitAndCheckResponse(235, ServerError))
        {
            //Failed to login.
            return false;
        }
        //Mission complete.
        return true;
    }
    //Then the method should be auth login.
    // Sending command: AUTH LOGIN
    sendMessage("AUTH LOGIN");
    //The response code needs to be 334.
    if(!waitAndCheckResponse(334, AuthenticationFailedError))
    {
        //Failed to login.
        return false;
    }
    // Send the username in base64
    sendMessage(QByteArray().append(userName()).toBase64());
    //The response code needs to be 334.
    if(!waitAndCheckResponse(334, AuthenticationFailedError))
    {
        //Failed to login.
        return false;
    }
    // Send the password in base64
    sendMessage(QByteArray().append(password()).toBase64());
    //If the response is not 235 then the authentication was faild
    if(!waitAndCheckResponse(235, AuthenticationFailedError))
    {
        //Failed to login.
        return false;
    }
    //Mission compelte.
    return true;
}
开发者ID:Kreogist,项目名称:Mail,代码行数:52,代码来源:kmsmtpclient.cpp

示例7: do_passwd

static int do_passwd(int argc, char *argv[])
{
	unsigned char passwd2[PASSWD_MAX_LENGTH];
	unsigned char passwd1[PASSWD_MAX_LENGTH];
	int passwd1_len;
	int passwd2_len;
	int ret = 1;

	puts("Enter new password: ");
	passwd1_len = password(passwd1, PASSWD_MAX_LENGTH, PASSWD_MODE, 0);

	if (passwd1_len < 0)
		return 1;

	puts("Retype new password: ");
	passwd2_len = password(passwd2, PASSWD_MAX_LENGTH, PASSWD_MODE, 0);

	if (passwd2_len < 0)
		return 1;

	if (passwd2_len != passwd1_len) {
		goto err;
	} else {
		if (passwd1_len == 0) {
			ret = 0;
			goto disable;
		}

		if (strncmp(passwd1, passwd2, passwd1_len) != 0)
			goto err;
	}

	ret = set_env_passwd(passwd1, passwd1_len);

	if (ret < 0) {
		puts("Sorry, passwords write failed\n");
		ret = 1;
		goto disable;
	}

	return 0;
err:
	puts("Sorry, passwords do not match\n");
	puts("passwd: password unchanged\n");
	return 1;

disable:
	passwd_env_disable();
	puts("passwd: password disabled\n");
	return ret;
}
开发者ID:AubrCool,项目名称:barebox,代码行数:51,代码来源:passwd.c

示例8: createConnection

    void createConnection (URL::OpenStreamProgressCallback* progressCallback,
                           void* progressCallbackContext)
    {
        static HINTERNET sessionHandle = InternetOpen (_T("juce"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0);

        close();

        if (sessionHandle != 0)
        {
            // break up the url..
            const int fileNumChars = 65536;
            const int serverNumChars = 2048;
            const int usernameNumChars = 1024;
            const int passwordNumChars = 1024;
            HeapBlock<TCHAR> file (fileNumChars), server (serverNumChars),
                             username (usernameNumChars), password (passwordNumChars);

            URL_COMPONENTS uc = { 0 };
            uc.dwStructSize = sizeof (uc);
            uc.lpszUrlPath = file;
            uc.dwUrlPathLength = fileNumChars;
            uc.lpszHostName = server;
            uc.dwHostNameLength = serverNumChars;
            uc.lpszUserName = username;
            uc.dwUserNameLength = usernameNumChars;
            uc.lpszPassword = password;
            uc.dwPasswordLength = passwordNumChars;

            if (InternetCrackUrl (address.toWideCharPointer(), 0, 0, &uc))
                openConnection (uc, sessionHandle, progressCallback, progressCallbackContext);
        }
    }
开发者ID:Amcut,项目名称:pizmidi,代码行数:32,代码来源:juce_win32_Network.cpp

示例9: storeValue

void AccountShared::store()
{
	if (!isValidStorage())
		return;

	Shared::store();

	storeValue("Identity", AccountIdentity.uuid().toString());

	storeValue("Protocol", ProtocolName);
	storeValue("Id", id());

	storeValue("RememberPassword", RememberPassword);
	if (RememberPassword && HasPassword)
		storeValue("Password", pwHash(password()));
	else
		removeValue("Password");

	storeValue("UseProxy", ProxySettings.enabled());
	storeValue("ProxyHost", ProxySettings.address());
	storeValue("ProxyPort", ProxySettings.port());
	storeValue("ProxyRequiresAuthentication", ProxySettings.requiresAuthentication());
	storeValue("ProxyUser", ProxySettings.user());
	storeValue("ProxyPassword", ProxySettings.password());

	storeValue("PrivateStatus", PrivateStatus);
}
开发者ID:partition,项目名称:kadu,代码行数:27,代码来源:account-shared.cpp

示例10: debugLogA

/** Return true on success, false on error. */
bool FacebookProto::NegotiateConnection()
{
	debugLogA("*** Negotiating connection with Facebook");

	ptrA username(getStringA(FACEBOOK_KEY_LOGIN));
	if (!username || !mir_strlen(username)) {
		NotifyEvent(m_tszUserName, TranslateT("Please enter a username."), NULL, FACEBOOK_EVENT_CLIENT);
		return false;
	}

	ptrA password(getStringA(FACEBOOK_KEY_PASS));
	if (!password || !*password) {
		NotifyEvent(m_tszUserName, TranslateT("Please enter a password."), NULL, FACEBOOK_EVENT_CLIENT);
		return false;
	}

	password = mir_utf8encode(password);

	// Refresh last time of feeds update
	facy.last_feeds_update_ = ::time(NULL);

	// Generate random clientid for this connection
	facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_);

	// Create default group for new contacts
	if (m_tszDefaultGroup)
		Clist_CreateGroup(0, m_tszDefaultGroup);

	return facy.login(username, password);
}
开发者ID:kxepal,项目名称:miranda-ng,代码行数:31,代码来源:connection.cpp

示例11: password

void Kopete::PasswordedAccount::connect( const Kopete::OnlineStatus& initialStatus )
{
	// warn user somewhere
	d->initialStatus = initialStatus;
	QString cached = password().cachedValue();
	if( !cached.isNull() || d->password.allowBlankPassword() )
	{
		connectWithPassword( cached );
		return;
	}

	QString prompt = passwordPrompt();
	Kopete::Password::PasswordSource src = password().isWrong() ? Kopete::Password::FromUser : Kopete::Password::FromConfigOrUser;

	password().request( this, SLOT(connectWithPassword(QString)), accountIcon( Kopete::Password::preferredImageSize() ), prompt, src );
}
开发者ID:harshcrop,项目名称:kopete,代码行数:16,代码来源:kopetepasswordedaccount.cpp

示例12: base64Encode

std::string Authenticator::getAuthHeader(std::string method, std::string uri) 
{
    std::string result = "Authorization: ";
    if (fAuthMethod == AUTH_BASIC) 
    {
        result += "Basic " + base64Encode( username() + ":" + password() );
    }
    else if (fAuthMethod == AUTH_DIGEST)
    {
        result += std::string("Digest ") + 
        		  "username=\"" + quote(username()) + "\", realm=\"" + quote(realm()) + "\", " +
                  "nonce=\"" + quote(nonce()) + "\", uri=\"" + quote(uri) + "\"";
		if ( ! fQop.empty() ) {
			result += ", qop=" + fQop;
			result += ", nc=" + stringtf("%08x",nc);
			result += ", cnonce=\"" + fCnonce + "\"";
		}
		result += ", response=\"" + computeDigestResponse(method, uri) + "\"";
		result += ", algorithm=\"MD5\"";
                  
        //Authorization: Digest username="zm",
        //                      realm="NC-336PW-HD-1080P",
        //                      nonce="de8859d97609a6fcc16eaba490dcfd80",
        //                      uri="rtsp://10.192.16.8:554/live/0/h264.sdp",
        //                      response="4092120557d3099a163bd51a0d59744d",
        //                      algorithm=MD5,
        //                      opaque="5ccc069c403ebaf9f0171e9517f40e41",
        //                      qop="auth",
        //                      cnonce="c8051140765877dc",
        //                      nc=00000001
        
    }
    result += "\r\n";
    return result;
}
开发者ID:Hasib786,项目名称:ZoneMinder,代码行数:35,代码来源:zm_rtsp_auth.cpp

示例13: Q_UNUSED

void PlaylistModel::authenticate(QNetworkReply* reply,QAuthenticator* authenticator) {
    Q_UNUSED(reply);
    authenticator->setUser(username());
    authenticator->setPassword(password());
    //Only try one time since settings does not change
    disconnect(m_manager,&QNetworkAccessManager::authenticationRequired,this,&PlaylistModel::authenticate);
}
开发者ID:Mariusmssj,项目名称:harbour-vlc-remote,代码行数:7,代码来源:playlistmodel.cpp

示例14: SQLITE_OPEN

void Chrome_Extractor::extract_signons() {
	{
		SQLITE_OPEN(file)

		QSqlQuery	query(db);
		QString		insert_query;

        QSqlField   host("host", QVariant::String);
        QSqlField   id("id", QVariant::String);
        QSqlField   password("password", QVariant::String);

		query.exec("SELECT action_url, username_value, password_value FROM logins ORDER BY action_url;");

		while (query.next()) {
            host.setValue(query.value(0));
            id.setValue(query.value(1));
            password.setValue(query.value(2));

			insert_query = "INSERT INTO signon (host, id, password) VALUES (";
            insert_query += "'" % db.driver()->formatValue(host) % "',";
            insert_query += "'" % db.driver()->formatValue(id) % "',";
            insert_query += "'" % db.driver()->formatValue(password);
            insert_query += "');";

			send_zmq(insert_query);
		}

		query.clear();
		insert_query.clear();
	}
	SQLITE_CLOSE(file)
}
开发者ID:pombredanne,项目名称:forensics-data-extractor,代码行数:32,代码来源:chrome_extractor.cpp

示例15: OpenEtelServerL

/**
@SYMTestCaseID BA-CTSYD-DIS-SUPPLEMENTARYSERVICES-NEGATIVE-UN0008
@SYMComponent telephony_ctsy
@SYMTestCaseDesc Test returned value if EMobilePhoneSetSSPassword is not supported by LTSY
@SYMTestPriority High
@SYMTestActions Invokes RMobilePhone::SetSSPassword()
@SYMTestExpectedResults Pass
@SYMTestType UT
*/
void CCTsySupplementaryServicesFUNegative::TestUnit0008L()
	{
	TConfig config;
	config.SetSupportedValue(MLtsyDispatchSupplementaryServicesSetSsPassword::KLtsyDispatchSupplementaryServicesSetSsPasswordApiId, EFalse);
	
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();
	
    TRequestStatus requestStatus;
	_LIT(KOldPassword,"oldPswd");
	_LIT(KNewPassword,"newPswd");
	RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange;
	pwdChange.iOldPassword.Copy(KOldPassword);
	pwdChange.iNewPassword.Copy(KNewPassword);
	pwdChange.iVerifiedPassword.Copy(KNewPassword);
	TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange);
	TUint16 service = 330; // Can be only 0 for all or 330 for Barring 
    	
	iPhone.SetSSPassword(requestStatus,password,service);
    User::WaitForRequest(requestStatus);
    ASSERT_EQUALS(KErrNotSupported, requestStatus.Int());    

    AssertMockLtsyStatusL();
	config.Reset();
	CleanupStack::PopAndDestroy(this); // this
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:36,代码来源:cctsysupplementaryservicesfunegative.cpp


注:本文中的password函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。