src/network/ssl/qsslkey.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     7 ** This file is part of the QtNetwork module of the Qt Toolkit.
     8 **
     8 **
   117 
   117 
   118     BIO *bio = q_BIO_new_mem_buf(const_cast<char *>(pem.data()), pem.size());
   118     BIO *bio = q_BIO_new_mem_buf(const_cast<char *>(pem.data()), pem.size());
   119     if (!bio)
   119     if (!bio)
   120         return;
   120         return;
   121 
   121 
   122     void *phrase = passPhrase.isEmpty()
   122     void *phrase = (void *)passPhrase.constData();
   123         ? (void *)0
       
   124         : (void *)passPhrase.constData();
       
   125 
   123 
   126     if (algorithm == QSsl::Rsa) {
   124     if (algorithm == QSsl::Rsa) {
   127         RSA *result = (type == QSsl::PublicKey)
   125         RSA *result = (type == QSsl::PublicKey)
   128             ? q_PEM_read_bio_RSA_PUBKEY(bio, &rsa, 0, phrase)
   126             ? q_PEM_read_bio_RSA_PUBKEY(bio, &rsa, 0, phrase)
   129             : q_PEM_read_bio_RSAPrivateKey(bio, &rsa, 0, phrase);
   127             : q_PEM_read_bio_RSAPrivateKey(bio, &rsa, 0, phrase);