in sonar cloud getting security hotspot as "Make sure that using this pseudorandom number generator is safe here" - jcaptcha

trying to generate jcaptcha image using random class.In sonar cloud getting security hotspot as "Make sure that using this pseudorandom number generator is safe here". How to generate jcaptcha image using RandomNumberGenerator in C# .net core?
How to generate jcaptcha image using RandomNumberGenerator in C# .net core?

Related

How to scan and connect to advertising BLE devices from C++ code?

I'm trying to search and connect to advertising Bluetooth Low Energy devices from C++ code.
I would like a piece of code to use laptop's wireless chip to discover and connect to BLE devices, regardless of their GATT Services.
I want in fine to use GATT properties (Services, Characteristics, Descriptors, Notification).
Programmatically
I have the BluetoothLEAdvertisementWatcher Class documentation from Windows API.
I tried to make working this example but without good results.
I also tried this example, but no success.
Manually
I figured out using Windows 10 Action Center, and use manual pairing to connect devices (because Windows con see and connect my device).
Then I could use directely the Windows.Devices.Bluetooth.GenericAttributeProfile Namespace
Is there a way to implement that automatically?
Hello Raphaƫl and welcome to stackoverflow. When you say "without good results" or "but no success", you should detail why (compilation error, runtime error...).
I used this piece of code:
Getting BLE Beacons in C++ Windows 10 Desktop Application
It compiles under Win10, so should the third link you posted (https://github.com/urish/win-ble-cpp) as it's very similar if you look at the includes here. Just note that this is not regular win32 projects: from Visual Studio you must create a new "Windows"/"Universal" C++ project, else they won't compile.
Alternatively, if you're OK with using a 3rd party library, you could simply use QtBluetooth, recent version supports windows 10. Then you can easily access BLE features from aregular win32 project.

mbedtls entropy generation (nv_seed)

I am using mbedtls as TLS library for amazon FreeRTOS running on my hardware(SAM4E).
The library has been ported and I am using nv_seed method to generate random numbers. I am reading and writing the 32Bit data to EEPROM.
I was getting the TLS handshake failure(hang). After debugging, I found out that the numbers saved and read from EEPROM is same all the time and that is the reason for handshake failure.
I cannot generate random numbers using hardware as I do not have dedicated TRNG. So, I have to make the seeding work somehow.

run a c++ application under spark cluster

I am working on my school project. there is a video duplication detection application wrote with c++. The application is designed to run on a single machine, and I would like to create a spark cluster and run that application under the cluster.
Is this possible? difficult?
Let me try to answer your question:
First, you should figure out that which format the c++ application has?
Is it source code or binary executable bin?
source code
You can implement the algorithm in java/scala, and make the most use of the cluster resouce, make you job much more quick that the single machine version.
if your time is limited, you can use gcc to compile your c++ source code, and follow the next method.
binary executable bin
Because java/scala bytecode(.class format) run on the jvm, not compatible with the native code on machine, which is determined by the combination of compiler and operating system.
In the case, the only choice is get a new process to execute the c++ executable bin, and get what you want through inter process communication, such as pipe.
In a word, you should get a new process on driver node to de-duplicate your data, and use spark engine to do the following parallel computing to accelerate you project.
and get new process is so easy in scala or java, please refer the doc:
Process

Qt Bluetooth Low Energy - Problems using non standard GATT

I have a device without knowing the used gatt profile, I only know that is something "homemade" and not anything known on the bluetooth-database.
In Linux the command
gatttool -i hci0 -b xx:xx:xx:xx:xx:xx --char-read --handle=42
returns the value as expected (with the target device mac at xx:xx:xx:xx:xx:xx).
In Qt I am using the Heartbeat-Example from http://doc-snapshot.qt-project.org/qt5-5.4/qtbluetooth-heartlistener-example.html
there they connect using a gattprofile, QBluetoothUuid::HeartRate and QBluetoothUuid::HeartRateMeasurement
I wasn't able to modify the example code in a way to read handle 42.
Can you explain where I have to put which values, that it connects to the "standard profile" as the gattool command does? If I use gatttool in interactive mode and ask primary it returns two uuids, but using them instead of the QBluetoothUuid::HeartRate did not work.
It doesn't appear that the Qt Bluetooth Low Energy API provides means for obtaining access to characteristics based on their handle value. (Neither does the Windows 8 BLE API.) You should use the UUID. Even if it's a homemade device, all services and characteristics are required by the GATT protocol to have UUIDs. The lowenergyscanner demo app can discover and display both the UUIDs and handles of all of the device's services and characteristics. I've used lowenergyscanner to deal with BLE devices I'm developing.
device discovering is by uuid, even if you create a new profile with a new service and a new characteristic, you have to give the new characteristic uuid in setup.
But i dont know, how to add multiple characteristics to one service, it does not work with me.
have fun

C++ Microphone Input As A Random Seed

I am currently playing around with some cryptography (RSA Public Key, in this case) and in order to generate a random key I need a random input. I figured the microphone would be a good source for relatively unreplicatable data. Is there any way to read the raw data out of a microphone in a way that can be used as to seed srand? Is there a better way to get a purely random seed and if so how would I do it?
I am running Windows 8 on a laptop with a built in mic and I am using the g++ compiler.
Do not try to get seed from hardware yourself. The OS knows a lot more than you about how to get quality randomness.
On Linux, the correct way is to read /dev/urandom (not /dev/random; it is actually worthless)
On Windows, Google indicates that you should use the CryptGenRandom function.