QByteArray CppGetByteArray(const CryptoMaterial &cm) { ByteQueue queue; cm.Save(queue); QByteArray data(queue.CurrentSize(), 0); queue.Get(reinterpret_cast<byte *>(data.data()), data.size()); return data; }
void CAuthenticationProfileImpl::sendPublicKey(RSA::PublicKey publicKey) { LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ ); ByteQueue queue; publicKey.Save(queue); UInt32 queueSize = queue.CurrentSize(); UInt8* outgoingData = new UInt8[queueSize + 1]; outgoingData[0] = static_cast<UInt8>(SEND_PUBLIC_KEY); queue.Get(outgoingData + 1, queueSize); LOG4CPLUS_INFO(msLogger, "***** " + convertIntegerToString(queueSize + 1) + " bytes sent"); iviLink::Channel::sendBuffer(mChannelID, outgoingData, queueSize + 1); delete[] outgoingData; }
bool ByteQueue::operator==(const ByteQueue &rhs) const { const unsigned long currentSize = CurrentSize(); if (currentSize != rhs.CurrentSize()) return false; for (unsigned long i = 0; i<currentSize; i++) if ((*this)[i] != rhs[i]) return false; return true; }
bool ByteQueue::operator==(const ByteQueue &rhs) const { const lword currentSize = CurrentSize(); if (currentSize != rhs.CurrentSize()) return false; Walker walker1(*this), walker2(rhs); byte b1, b2; while (walker1.Get(b1) && walker2.Get(b2)) if (b1 != b2) return false; return true; }