url encode the base64 signature/key

This commit is contained in:
David Kelly 2017-08-14 13:48:09 -07:00
parent 803a5c6690
commit 170d2b186b

View file

@ -207,7 +207,7 @@ bool Wallet::createIfNeeded() {
qCDebug(commerce) << "read private key"; qCDebug(commerce) << "read private key";
RSA_free(key); RSA_free(key);
// K -- add the public key since we have a legit private key associated with it // K -- add the public key since we have a legit private key associated with it
_publicKeys.push_back(publicKey.toBase64()); _publicKeys.push_back(QUrl::toPercentEncoding(publicKey.toBase64()));
return false; return false;
} }
} }
@ -219,9 +219,8 @@ bool Wallet::generateKeyPair() {
qCInfo(commerce) << "Generating keypair."; qCInfo(commerce) << "Generating keypair.";
auto keyPair = generateRSAKeypair(); auto keyPair = generateRSAKeypair();
// TODO: do we need to pass params in here to make sure this is url-safe base64? _publicKeys.push_back(QUrl::toPercentEncoding(keyPair.first->toBase64()));
_publicKeys.push_back(keyPair.first->toBase64()); qCDebug(commerce) << "public key:" << _publicKeys.last;
qCDebug(commerce) << "public key:" << keyPair.first->toBase64();
// It's arguable whether we want to change the receiveAt every time, but: // It's arguable whether we want to change the receiveAt every time, but:
// 1. It's certainly needed the first time, when createIfNeeded answers true. // 1. It's certainly needed the first time, when createIfNeeded answers true.
@ -264,7 +263,7 @@ QString Wallet::signWithKey(const QByteArray& text, const QString& key) {
if (encryptReturn != -1) { if (encryptReturn != -1) {
// TODO: do we need to pass options in here to make sure it is url-safe? // TODO: do we need to pass options in here to make sure it is url-safe?
return signature.toBase64(); return QUrl::toPercentEncoding(signature.toBase64());
} }
} }
return QString(); return QString();