AsymmetricCryptography : An extension for asymmetric cryptography

Can someone explain why this wont work?


If I dont encrypt the tag then it works but as soon as i try with the encypted tag i get errors as shown in the .aia

Testing.aia (14.5 KB)

Probably you haven't generated key pair. Also, you will have to store initial keys as they will be different when you generate them next time.

Nope, generated keypair and stored as global variable. Generated keypair on screen initialize and get successful message and yes the keys will be stored wondered why this didn't work alone. Like I said if I am in companion mode and try those blocks it fails to provide anything, as soon as I take away the encrypted tag for storage then it all works.

Maybe somekind of limit on tinydb tag length? As it is not meant to store large amount of data.

Yeah that's what I was thinking as well but haven't had time to test that yet. Just gonna try segmenting the encrypted data at a smaller length.

Nope doesn't seem like it's a tag size issue either
Results I get are

block now looks like

What does encrypt cat look like in a label ?

just testing that now, that is the problem, every time i encrypt cat with the same keys it gives me a different output?

The parts in the list view are all my attempts at encrypting the word cat.

Why would it change every time?

To encrypt a string whose length is x, you will have to generate key-pair of length 8x + c, where c > 1. (for padding) :sweat_smile:

Right ? But the generated key is 1024 and I put in the word cat so that's plenty big enough right?

I even tried with 4000 and same thing. It's all to do with the encrypted text changing each time the word is encrypted, so I can't call data from tinydb as the data changes every time. That's when I get the error when it can't find the data. If I don't encrypt the tinydb tag , it encrypts, stores and decrypt fine without error

It is quite clear from here.

I am sorry but I don't understand what your trying to show in your last comment?

Are you just shoeing that the encrypted data is different each time like I already mentioned?

I'd so how are you meant to use it with a database when you can't search for the same tag?

Show how you are using your procedures... encrypt and decrypt.

Also check the documentation from the first post.

They literally just call the encrypt part of the extension with the private or public key attached and the input being what it encrypts.

And yes I read the documentation from the first post before I commented. Like I said everything works fine if the tag isn't encrypted.

All I want to know is why the encrypted text changes everytime. Surely if your using the same keys everything you encrypt the same word it should output the same thing right?

My problem is I can't search for the tag in the tinydb if the encrypted data isn't constant.

Probably this is the issue. They aren't same.

Yes but why aren't they the same?

I am not sure if this is the correct answer but i have read somewhere that all the encrypted text are different but when you decrypt it , it will give the same text. Thats to maintain security.
Correct me if i am wrong.

1 Like

But with that being the case how are you meant to retrieve encrypted data from a database?

Only way I can think to do it is to decrypt every tag and compare them each in turn with the searched tag. And when you have 100s of tags that is going to use a lot of resources and take a while to do so it's not exactly feasible.

You should use Symmetric Encryption then as Asymmetric Encryption can be difficult to manage.

Then i would suggest to make your own encrypt and decrypt with replace text.