source code in c# for certificateless cryptography (mCL-PKE) - mcl

may I ask for some help on the source code for mCL-PKE in C#?
I have seen a few papers that introduce the concept for proposed cloud sharing system, but I still have not found any of the source code yet for it seems this concept is quite new. I'm not into proving how the algorithm works, but rather just applying the source code into the system. Thank you so much!
Some of the papers:
An Efficient Certificateless Encryption for Secure Data Sharing in Public Clouds
http://docs.lib.purdue.edu/cgi/viewcontent.cgi?article=1621&context=ccpubs
Encryption of secure data by mCL-PKE technique for the effective storage and retrieval in public cloud
http://www.ijiiet.com/papers/2015/May/E1536.pdf
Certificateless Public Key Cryptography www.iacr.org/archive/asiacrypt2003/12_Session11/28_118/28940457.pdf

Related

Is the example proposed by Microsoft for cryptography secure enough, or should I learn more?

This is the article published by Microsoft for encrypting/decrypting data using RSA:
https://learn.microsoft.com/en-us/dotnet/standard/security/walkthrough-creating-a-cryptographic-application
As a relatively new person into the cryptography world and having read a comment on stackoverflow saying that cryptography should use a hybrid model, I researched that and it seems that hybrid models use AES and RSA for encryption and I was wondering if the example provided by Microsoft fits into the hybrid model since it uses both and if is constructed well enough and not just for novice devs just venturing into the world of cryptography.
I already have a working example where an app would encode and another would decode by loading the private key file, similar to the example.
I found an article here:
https://www.codeproject.com/Tips/834977/Using-RSA-and-AES-for-File-Encryption
He creates signatures and manifests and I'm wondering if this is what I'm looking for is Microsoft's example generally just enough, or weak?
PS: I removed the key container code and persistence as I don't want to persist or store my keys on the local machine, instead they are exported as standalone files to be stored in a DB maybe, so I'm not looking for opinions on that part at the moment.
and not just for novice devs just venturing into the world of cryptography
Well, at least it tries to define some kind of protocol, although very sparse. It also uses CBC mode (implicitly, never a good idea) and RSA with PKCS#1 v1.5 padding for encryption. Most people would opt for OAEP if RSA is used and use an authenticated cipher such as GCM.
I already have a working example where an app would encode and another would decode by loading the private key file, similar to the example.
Bad idea, the example is for file encryption, not for transport mode security, for which you need a secure transport protocol. Both the RSA implementation and CBC implementation are malleable, and are both susceptible to padding oracle attacks as well.
I don't want to persist or store my keys on the local machine
You need to establish trust, something that is missing from the example. And to establish trust you do need to persist your keys, especially if they have been randomly generated.
In the end, asking if something is secure depends on context: you need to know what your goals are and then check if the protocol provides enough protection to achieve these goals.
This is also my problem with these generic examples or wrapper classes; they make no sense to me, as the generic security that they seem to provide may not fit your use case; I'd rather design a protocol specific to the use case.

Does the NPM package crypto-js relate to cryptocurrency or cryptography?

I'm watching a football game # https://watch.foxtel.com.au/ and I saw in the inspector the site loads the file:
https://watch.foxtel.com.au/app/static/js/npm.crypto-js.7f96017841bd7fff1e02.chunk.js
I think this relates to https://www.npmjs.com/package/crypto-js
Does that NPM package relate to cryptocurrency or cryptography?
Help appreciated.
crypto.js is purely a cryptography library, without a focus on cryptocurrency specifically.
Looking at the docs, indeed crypto.js does support ECDSA over secp256k1, and SHA256, the primary cryptographic primitives used in most Bitcoin derived cryptocurrencies.
I guess technically you could leverage its hashing functions to mine, and its ECDSA signature functions to create BTC transactions, but it certainly wouldn't be a library I would use writing an attack like that, there are many other libraries much better suited.
If you used crypto.js for cryptocurrency related work, one would have to build out all of the cryptocurrency specific stuff from first principles, (e.g. conversion of elliptic curve points (after scalar multiplication) to valid public keys, and on to base58 encoded Bitcoin addresses, etc).
It's much more likely it was used to leverage a cryptographic primitive for authentication or equivalent.
Update:
This actually just looks like the crypto module from Node, thus definitely not cryptocurrency related.

Authentication tips using NTAG 424 DNA TT

I need to implement an authentication procedure between a reader an NFC tag but being my knowledge limited in this area I will appreciated some aid in order to understand few concepts.
Pardon in advance for rewrite the Bible but I could not summarize it more.
There are many tags families ( ICODE, MIFARE, NTAG...) but after doing a research I think NTAG 424 DNA matches my requirements(I need mainly authentication features).
It comes with AES encryption, CMAC protocol and 3-pass-authentication system and here is when I started to need assistance.
AES -> As I am concerned this is a block cipher to encrypt plain texts via permutations and mapping. Is a symmetric standard and it does not use the master key, instead session keys are used being them derivations from the master key. (Q01: What I do not know is where this keys are stored in the tag. Keys must be stored on specialized HW but no tag "specs" remark this, apart from MIFARE SAM labels.)
CMAC -> It is an alteration of CBC-MAC to make authentication secure for dynamically sized messages. If data is not confidential then MAC can be used on plain-texts to verify them, but to gain confidentiality and authentication features "Encrypt-than-mac" must be pursuit. Here also session keys are used, but not the same keys used in the encryption step.(Q02: The overall view of CMAC may be a protocol to implement verification along with confidentiality, this is my opinion and could be wrong.)
3-pass-protocol -> ISO/IEC 9798-2 norm where tag and reader are mutually verified. It may also use MAC along with session keys to achieve this task.(Q03: I think this is the upper layer of all the system to verify tags and readers. The "3 pass protocol" relays in MAC to be functional and, if confidentiality features are also needed, then CMAC might be used instead of single MAC. CMAC needs AES to be functional, applying session keys on each step. Please correct me if I am posting savages mistakes)
/*********/
P.S: I am aware that this is a coding related forum but surely I can find here someone with more knowledge than me about cryptography to answer this questions.
P.S.S: I totally do not know where master and session keys are kept in the Tag side. Have they need to be include by a separate HW along with the main NFC circuit ?
(Target)
This is to implement a mutual verification process between tag and reader, using the NTAG 424 DNA TagTamper label. (The target is to avoid 3ยบ parties copies, being authentication the predominant part instead of message confidentiality)
Lack of knowledge of cryptography and trying to understand how AES, CMAC and the mutual authentication are used on this NTAG.
(Extra Info)
NTAG 424 DNA TT: https://www.nxp.com/products/identification-security/rfid/nfc-hf/ntag/ntag-for-tags-labels/ntag-424-dna-424-dna-tagtamper-advanced-security-and-privacy-for-trusted-iot-applications:NTAG424DNA
ISO 9798-2: http://bcc.portal.gov.bd/sites/default/files/files/bcc.portal.gov.bd/page/adeaf3e5_cc55_4222_8767_f26bcaec3f70/ISO_IEC_9798-2.pdf
3-pass-authentication:https://prezi.com/p/rk6rhd03jjo5/3-pass-mutual-authentication/
Keys storage HW:https://www.microchip.com/design-centers/security-ics/cryptoauthentication
The NTAG424 chips are not particularly easy to use, but they offer some nice features which can be used for different security applications. However one important thing to note, is that although it heavily relies on encryption, from an implementation side, that is not the main challenge, because all of the aes encryption, cmac computation and so on is already available as some sort of package or library in most programming languages. Some examples are even given by nxp in their application note. For example in python you will be able to use the AES package from Crypto.Cipher import AES as stated in one of the examples of the application note.
My advice is to simply retrace their personalization example beginning at the initial authentication, and then work your way up to whatever you are trying to achieve. It is also possible to use these examples in order to test the encryption and the building of apdu commands. Most of the work is not hard, but sometimes the NXP documents can be a bit confusing.
One small note, if you are working with python, there is some code available on github which you might be able to reuse.
For iOS, I'm working on a library for DNA communication, NfcDnaKit:
https://github.com/johnnyb/nfc-dna-kit

Mifare classic 1K Reading/Writing implementation with ST25R3911B

I'm completely new in the NFC field, I want to build an application by using Mifare classic 1K with ST25R3911B, For that purpose i have to make proper communication between them by which i can do communication between them(Like to read/write operation).
I'm getting success to read UID, but rest of the things i'm not understand like how to authenticate or which is the proper command by which i can do communication or shares information between them.
If anyone have experience or any knowledge regarding that please help me,
Any kind of help would be appreciated!
Thank in advance!
I haven't used this chip, but I see its datasheet says that it supports Mifare as a custom protocol that you need to implement yourself as there is no generic method that is handled by the chip itself. That would mean you will need to implement the protocol based on NXP documentation including proprietary cryptography that is used there. If its only your private pet project, you could probably get away with some reverse engineered implementation that is floating around the internet, but the right way to do it is to contact NXP and obtain the license. Probably a way easier solution would be to replace the chip with something already licensed by NXP.

need primitive public key signature with out of band key distribution

I want to send an out of band message (don't worry about how it gets there) to a program I've written on a distant machine. I want the program to have some confidence the message is legit by attaching a digital signature to the message. The message will be small less than 200 characters.
It seems a public key based signature is what I want to use. I could embed the public key in the program.
I understand that the program would be vulnerable to attack by anyone who modifies it BUT I'm not too worried about that. The consequences are not dire.
I've looked through the MSDN and around the web but the prospect of diving in is daunting. I'm writing in straight c++, no NET framework or other fancy stuff. I've had no experience including NET framework stuff and little luck during previous attempts.
Can anyone point me at some very basic resources to get me started?
I want to know
How to generate the public and private keys
How to sign the message
How to verify the signature
You could try looking at the Keyczar library. It provides a high level abstraction to cryptographic functions with the aim to make is easy for developers to do crypto correctly. As an added bonus it has c++ bindings.
There is also Cryptlib which has been around for a while, and NaCl. As with Keyczar these libraries aim to provide a high level abstraction for common crypto functions.
gpgme is a high-level cryptographic API for GnuPG, written in C, but with bindings for a number of languages. GnuPG has excellent docs and is easy to use, so you can play around 'manually' on the command line and get a feel for how the key operations work, then look up the functions you need for your code in the API.