Coder Social home page Coder Social logo

Comments (9)

leocavalcante avatar leocavalcante commented on July 18, 2024

The error is saying that it could not find the public_key.pem file. There is a file with that name in the same directory you are running dart?

from encrypt.

NTMS2017 avatar NTMS2017 commented on July 18, 2024

Yes it is. And it is in the bin folder.

I craeted 2048 bit key file using online tools.

unttiled (project)

  • ... some other files till bin
  • bin
    • main.dart
    • ntms_rsa.dart
    • ntmsSetPrivate.dart
    • private_key.pem
    • public_key.pem

from encrypt.

NTMS2017 avatar NTMS2017 commented on July 18, 2024

I am using intellij and created demo dart console app for testing.

from encrypt.

NTMS2017 avatar NTMS2017 commented on July 18, 2024

ok I put them in lib directory and its working. This time I got "pointycastle" error. How can I solve this.

Unhandled exception:
Invalid argument(s): Input data too large
#0 PKCS1Encoding._encodeBlock (package:pointycastle/asymmetric/pkcs1.dart:101:7)
#1 PKCS1Encoding.processBlock (package:pointycastle/asymmetric/pkcs1.dart:92:14)
#2 BaseAsymmetricBlockCipher.process (package:pointycastle/src/impl/base_asymmetric_block_cipher.dart:15:15)
#3 RSA.encrypt (package:encrypt/src/algorithms/rsa.dart:27:30)
#4 Encrypter.encryptBytes (package:encrypt/src/encrypter.dart:11:17)
#5 Encrypter.encrypt (package:encrypt/src/encrypter.dart:16:12)
#6 setPrivate (file:///Users/niyazitoros/niyazitoros/IdeaProjects/untitled/bin/ntmsSetPrivate.dart:10:31)

from encrypt.

NTMS2017 avatar NTMS2017 commented on July 18, 2024

I keep getting too large error. I am using 2048 bir rsa public and private key. The text is below.
how can I return version 2.1.0? It seems version 3.1.0 cannot handle below text size.

Unhandled exception:
Invalid argument(s): Input data too large
#0      PKCS1Encoding._encodeBlock (package:pointycastle/asymmetric/pkcs1.dart:101:7)

Text:
String myString = "1967-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elementum pharetra tellus a consequat. Aenean risus diam, vehicula sed suscipit vitae, ornare in lectus. Sed maximus eu justo ac rutrum. Donec maximus nunc a elementum hendrerit. Quisque vulputate mattis ligula nec pulvinar. Vestibulum vitae mauris eget ligula eleifend tempus. Curabitur id ultrices sapien, ut gravida risus. Sed auctor nisi ac suscipit maximus. Proin volutpat eros ut ex tincidunt, non commodo mauris cursus. Vestibulum finibus porttitor lobortis. Fusce quis suscipit mi. Vivamus nec finibus quam, et tristique sapien. Nunc id consectetur turpis. Praesent eget egestas ligula. Nulla ut accumsan orci. In sed eros a ex imperdiet fringilla ut sit amet orci. Fusce nec fermentum odio, imperdiet accumsan velit. Mauris quis neque iaculis turpis ornare commodo. Phasellus dignissim ipsum a elit congue ornare. Phasellus in imperdiet lorem. Sed et lacus laoreet, eleifend mauris vel, aliquet elit. Etiam sed ligula posuere nunc vulputate mattis id sed diam. Vivamus maximus tristique neque. Aenean suscipit, orci ut feugiat molestie, turpis tellus viverra ex, vitae tincidunt enim tortor in felis. Sed sed commodo justo, vitae porttitor libero. Cras est enim, ultrices vel placerat sit amet, scelerisque quis ex. Nullam vel consectetur libero. Proin commodo metus in lectus efficitur malesuada. Pellentesque erat magna, convallis sit amet rhoncus nec, congue a odio. Phasellus lorem risus, convallis in iaculis nec, interdum id dolor. Nullam congue ut leo id pulvinar. Nullam maximus quam ac arcu maximus molestie. Maecenas molestie ullamcorper orci, ut convallis orci posuere at. Nullam nec dolor non nisl semper dapibus. Fusce cursus lacus sit amet auctor sodales. Nulla nibh arcu, iaculis vitae mollis at, consectetur ultrices sapien. Pellentesque imperdiet justo at vulputate tempor. Quisque a est ipsum. Sed varius ac est id sodales. Nam porta lectus augue, at aliquet augue tristique non. Suspendisse potenti. Curabitur eu sem et risus efficitur elementum in sed sapien. Quisque laoreet lobortis massa sed molestie. Vestibulum luctus aliquet lacus eu pretium. Suspendisse nec sodales orci. Donec fermentum ligula nec arcu hendrerit, quis tristique sem consectetur. Etiam pulvinar turpis eget metus iaculis imperdiet. Proin ut odio dignissim massa rhoncus ornare. Cras quam nibh, cursus at porttitor nec, rutrum vel est. Duis lorem mauris, vestibulum non nunc ac, tincidunt convallis dui. Suspendisse rhoncus turpis non sem consectetur, in vehicula purus condimentum. Maecenas accumsan mi sapien, in tristique nisi imperdiet et. Sed et nulla non nunc laoreet mattis. Ut a quam eget quam lacinia pellentesque eleifend vitae purus. Nulla tempus nec quam quis posuere. Nam at cursus felis. Vestibulum a ante non neque mattis fermentum. Sed ut aliquet tortor, non pharetra est. Nam non varius diam. Sed est nisi, laoreet sed eros ac, posuere vehicula lacus. Nullam metus risus, vehicula sit amet lorem laoreet, vehicula congue tellus. Nulla enim dolor, faucibus at nisl quis, mattis consequat est. Praesent interdum fermentum ultricies.-2019.";

from encrypt.

NTMS2017 avatar NTMS2017 commented on July 18, 2024

When I use version 2.1.0 AES same text works perfectly. Before closing the issue I need ask a question. Which is more secure in my example the RAS or AES?

I use below code and above my post the text worked as I expected. Sorry my last question. Can I increase key and iv length? say 128 to 32?

final key = Key.fromUtf8(_ntmsRsa.PRIVATE_KEY); //Key.fromLength(32);
final iv = IV.fromUtf8(_ntmsRsa.IV_KEY); //IV.fromLength(8);

from encrypt.

leocavalcante avatar leocavalcante commented on July 18, 2024

RSA+PKCS1 can handle only 245 bytes, your input is way too large.

Can't tell which is more secure, they play very different roles, even being symmetric and asymmetric, you must find out what fits best for your needs.

from encrypt.

leocavalcante avatar leocavalcante commented on July 18, 2024

Closed due inactivity.

from encrypt.

developmentkws avatar developmentkws commented on July 18, 2024

Solved , Check : Solution

from encrypt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.