Solana: calculate PDA in Java/Kotlin - solana

I need to calculate PDA (Program Derived Address) using Java/Kotlin open-source libraries.
In Solana Web3 Javascript library there is an algorithm, which internally uses Tweetnacl-JS.
Unfortunately, my knowledge of cryptography is not enough to port this to Java.

I found an awesome Solana.kt library that has PDA calculation

Related

Best language to build a Raspberry Pi User Interface

I would like to create a user interface to control a Raspberry Pi movable arm via USB. What is the best programming language to use that will allow me to create both a user interface and interact with Raspberry Pi?
With the question of what is the "best" you are going to draw too many opinions.
The question I would ask is ....
Where will the UI exist?
Native
Web
API
The "best" is probably the one you are most familiar with to be honest. With all the new tech these days (given there still are considerations) you should be able to deploy to any of those locations in a fair amount of time and get your UI to signal your robot arm.
As far as your hardware side of things, I think many frameworks in a number of the languages support a good number of those as well. Here are a few examples.
http://gobot.io/
https://cylonjs.com/
http://artoo.io/
I recommend using Tkinter in python for making a GUI. But, if you want to interface with the pi through the internet, you can use the https://thingsboard.io interface.
This tutorial shows you how to use guizero, which is a wrapper for tkinter(making it even easier to use) -
https://projects.raspberrypi.org/en/projects/getting-started-with-guis
You should also checkout the dedicated stackexchange forum for pi for more related answers-
https://raspberrypi.stackexchange.com/questions/1353/recommended-gui-toolkit-for-python-development-on-the-raspberry-pi

RSA Encryption/decryption within windows crypto library dll?

I'm in a situation that I need to use AES-256, SHA1,2 and RSA, but these functions need to be loaded from an intrinsic windows dll file (something like cryptoAPI in advapi32.dll, which can be found in C:\Windows\system32).
I've found almost everything I need in advapi32.dll except RSA encryption. So,do you know any other crypto libraries from windows (XP2 should be supported)?
In the worst case, any free external crypto library in dll format is appreciated.
RSA encryption/decryption is supported by the CryptoAPI.
From http://en.wikipedia.org/wiki/Microsoft_CryptoAPI:
[...]It is a set of dynamically linked libraries that provides an abstraction layer which isolates programmers from the code used to encrypt the data.
So, advapi32.dll ≠ CryptoAPI. However, since it is an abstraction of the CryptoAPI functions, linking to that dll should expose whichever functionality you need, algorithm-agnostic.
To answer the question strictly, the CSP library file that handles RSA stuff is rsaenh.dll. However, I'm not sure why you should need to know that necessarily; like #SimonMourier (and I) stated, CryptoAPI handles linking to the appropriate CSP. Calling the appropriate functions from advapi32.dll should allow the use of a variety of algorithms, including RSA.
If you're really that averse to using the built-in Windows stuff then there's always Crypto++. It supports being compiled as a DLL afaik. http://www.cryptopp.com/
Without using .Net or a 3rd party component, I've found no reasonable solution for RSA in windows. So, about .Net, please see klugerama's last comment. About 3rd party component, I've found a great library for VB6 user, which will works in Windows XP without the installation of .NetFramework 2.0+. It's called VBCOrLib :
http://www.kellyethridge.com/vbcorlib/
Alternative solution for C++ users was Crypto++ as suggested by RaptorFactor.
Thanks for all your helps !

What modbus library should I use for modbus protocol for GCC

We are building a product, which requires modbus communication (both rs-485 and TCP/IP). The code has to run on an embedded device which has Linux running on it. We have following criteria for the selecting the library that we would be using.
It has to be opensource, since we are opensource geeks.
We would give this product to our users and what their application would be we are not aware, hence it has to complete implementation of the modbus protocol.
Wide user base: What we believe is that greater the users of the code, more the stability of the code.
I came across two such libraries:
http://www.freemodbus.org
and
libmodbus
Are there any more modbus libraries. Please suggest with pros and cons
I'd suggest libmodbus, it works well and is cross platform.
http://www.libmodbus.org
I am just starting to explore these options as well. My priority is on ease of use which has led me to RModBus since it was the only one that I was able to get immediate results with. However, there is also a Python library, Pymodbus, that appears to be quite complete in implementation.
I'm sorry, I just figured out that GCC is a compiler; my answer is way off topic.
Again, I was looking for a scripting language that my noob self could be more comfortable in. It really came down to a question of language rather than the library itself. Oh, I am only using the TCP/IP stack at this time, which somewhat simplifies it as well.

C++ equivalent to SerializeWithLengthPrefix

I built a communication library using Protocol Buffers (protobuf-net) using Sockets (TcpListener and TcpClient) and it is working fine, but now a co-worker needs to write a library to communicate with my software using C++.
Turns out that I'm using the Serializer.NonGeneric.SerializeWithLengthPrefix and Serializer.NonGeneric.TryDeserializeWithLengthPrefix.
Are there equivalent functions in the protobuf C++ libraries? If not, anyone knows how to implement it, or have it implemented to share?
I'm not hugely familiar with the C++ API; but the length prefix itself is pretty simple if you write the data to a buffer first, especially if you use the fixed-width 32-bit encoding (rather than base-128 variable-length). See also this thread on the google-groups forum.

Hardware Acceleration for non-SSL based signing and encryption

I am working on a project that does a large amount of hashing, signing, and both asymmetric and symmetric encryption. Since these steps have a significant effect on our performance and available load, I was wondering if there is a hardware based solution to offloading the work.
I have done some surfing to find out, and the only items I can find are dedicated to SSL based communications. I need a more generic solution that will allow me to speed up signing and encryption regardless of where it occurs.
Is it possible to adapt these SSL based solutions (maybe it's just marketing and it would be easy to re-use elsewhere)? Is there a good generic co-processor that can help out?
I need this on a Windows Server 2008 based box, but I would be interested in solutions on any platform.
If the algorithms you're working on are standard encryption algorithms like 3DES and AES, there is definitely hardware available. Hifn is the most well known, but Broadcom also has a line of chips from their BlueSteel acquisition a number of years ago. nCipher also has a line of encryption products, though when last I looked at them (years ago) they were much more focussed on their secure key management hardware than the acceleration of block algorithms.
Even cards designed for SSL may be useful to you, though you'll need to get access to the low level details. The biggest win for SSL hardware is an exponentiator and wide multipler unit, both of which are generally accessible independently in the hardware I know of. If you're using asymmetric encryption algorithms, these two units would likely be useful to you as well.
You should also check whether a more efficient software implementation is available. For example, Dan Bernstein and Peter Schwabe published a paper in September 2008 regarding optimization of AES for modern CPUs. The software implementation has been placed in the public domain (i.e. disavow all copyright, use it however you like).
Finally, future AMD (and probably Intel) CPUs will include SSE5, which adds instructions specifically useful for AES. If you can hold out until then, your next server upgrade may provide all the hardware support you need.
I'm not sure how helpful this will be, however I have seen a few papers dealing with using Graphics Hardware to accelerate encryption
Heres a quick google search
Good Luck.
Several companies make cryptography-specific hardware. For example, I recently coded support in an application for a nCipher hardware device which processed AES on the card (and supported many other encryption algorithms). They are not cheap, but they do support a variety of algorithms and modes of operation.
The most popular hardware crypto engine is VIA Padlock, included in C3, C7 and later processors. These are low-performance, low-power; but (supposedly) easily outperform a Core2 on crypto algorithms.
Linux kernel 2.6.16 and later include support for RNG, MD5, SHA1/256, SSL, GPG and other standard things. I'm not sure about ssh.
You mention non-SSL, so you might not benefit from existing code, but Via's site has the documentation needed to use it from userspace.
On windows you want to find a device that has an API that supports MSCAPI, CAPING or PKCS#11, The first and last are all very common, MSCAPI however does not support hardware AES/3DES.
nCipher (now Thales) Do several boxes or PCI/PCIe cards that support the above (and support openssl) and also support other platforms inlcuding Linux and Solaris, Safenet do similar hardware too with similar platform support.
If I were starting out I would pick PKCS#11, you then get a good choice of languages to write in including C or java.
If you want to write in C#/.Net then you can use MSCAPI from .Net or you can PInvoke into the PKCS#11 DLL for your hardware.

Resources