2

Hello I am a novice developer. And just gave me a project to iOS, but I have to encrypt part ciert an information.

I have to use 1024-bit RSA. The only thing they give me is a public key:

BitStrength = 1024

RSAKeyValue

Modulus = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Exponent = Xxxx

RSAKeyValue

Example: a string unencrypted and encrypted

Unencrypted string:

Prueba de Encriptacion

Encrypted string above:

uaUbBBR6Ghx/6EaspBB1QD024uUZ7O+koeNd0PTAt/wnM5w8s8TqRSGnB9iK7oSyRce4BPuVzFzsB2P34/fq5MoyuKvPG6vDZp8Ck/GifZAOZN1dbCRgOdE8qboKcWYH3WcZieUfpBepBwR6usY2xWaH9/56PCeSaDgncSPGrWc=bcrcdoaSp0zSv6hKc0jqh2oyVtLOaMmSqLxNRVpD62ojwfkFFb8zTJVFBUpxNmDCU4b0xgP0iYu9rRVBlo0Yp2GhoCgz/cR9+PRwOXWJYoV4Qd1j7zHZDsMy7njE8hBoU6N6ZVYkEhIfQ8z1TqOQyWeNUcll3JqaHNEqsF4w0Io=

I have to get the encrypted string. no need to decrypt

This is the first time I work with RSA encryption and truth I have no idea how to do it and also do not understand that use of the Exponent sent to me, as I read this encryption works but not how to implement iOS.

merv
  • 67,214
  • 13
  • 180
  • 245
rkv
  • 118
  • 2
  • 13
  • 2
    you should stay away from implementing encryption if you do not fully understand it, and even if you do you should NEVER implement an RSA algorithm yourself. You can cause serious damage to your client and their users. – Kaan Dedeoglu Oct 31 '12 at 11:17
  • I understand what you're saying but the customer want that and want to implement it, I have warned before taking this job. – rkv Oct 31 '12 at 11:30
  • I see your point, what is the time frame of the project? If its a few weeks, I suggest you go to udacity.com and enroll for the cryptography class and start watching, its awesome :) – Kaan Dedeoglu Oct 31 '12 at 11:43

1 Answers1

1

this question might help you

RSA implementation's in Objective C

(IOS) RSA Encrypt/Decrypt AES Key

Community
  • 1
  • 1
Kassem
  • 1,481
  • 3
  • 20
  • 42
  • I've checked and the code works fine, no problem. But I do not understand where I have to apply it to 1024 bits and where I have to apply the exponent. How do I get the result in string. – rkv Oct 31 '12 at 11:33
  • i guess this line is what you need const size_t CIPHER_BUFFER_SIZE = 1024; also to test the code of the first link, just call the method testAsymmetricEncryptionAndDecryption – Kassem Oct 31 '12 at 11:42
  • Absolutely, it works perfect. The problem is: When I do run I returned this result. Original plain text: Prueba Encriptacion Encrypted text: ? '"[OCC?, = -? ? HeZÔÁƒ-g, ˚ EF "BAR (NO, seems Base64) This should show:uaUbBBR6Ghx/6EaspBB1QD024uUZ7O+koeNd0PTAt/wnM5w8s8TqRSGnB9iK7oSyRce4BPuVzFzsB2P34/fq5MoyuKvPG6vDZp8Ck/GifZAOZN1dbCRgOdE8qboKcWYH3WcZieUfpBepBwR6usY2xWaH9/56PCeSaDgncSPGrWc=bcrcdoaSp0zSv6hKc0jqh2oyVtLOaMmSqLxNRVpD62ojwfkFFb8zTJVFBUpxNmDCU4b0xgP0iYu9rRVBlo0Yp2GhoCgz/cR9+PRwOXWJYoV4Qd1j7zHZDsMy7njE8hBoU6N6ZVYkEhIfQ8z1TqOQyWeNUcll3JqaHNEqsF4w0Io=) Decrypted text: Prueba Encriptacion – rkv Oct 31 '12 at 12:06