I was wondering just what type of encoding i would need to use in order to manually encrypt/decrypt messages. I have a modulus, and both exponents, but both are in 2-byte format. the modulus is 2048-bits long, and i don't know what i would need to convert it to in order to manually encrypt/decrypt my messages.
Mainly, i developed a system where i generate a SHA1 hash of a file, and encrypt it with my public keypair, and then before loading the file i would run a SHA1 hash again, and decrypt the stored hash, and check both of them to see if they're both the same. Now I have a couple problems with this.
firstly, my SHA1 hash is supposed to be 20-bytes long, but i get 40-bytes (possibly 2-byte hex?), and secondly, my modulus is in 2-byte hexadecimal format, but my exponents aren't.
Now i want to be able to manually encrypt messages, and decrypt messages (I have a special need for doing it manually) using the formula:
encrypt(T) = (T^E) mod PQ
T = result, E=public exponent, PQ = modulus.
so i think that i need to convert it to a decimal format?
such as the example from this site:
uses smaller exponents, and a smaller modulus, mine's much larger, i just need it to be an integer, or whatever type of number is used.
Mainly, i developed a system where i generate a SHA1 hash of a file, and encrypt it with my public keypair, and then before loading the file i would run a SHA1 hash again, and decrypt the stored hash, and check both of them to see if they're both the same. Now I have a couple problems with this.
firstly, my SHA1 hash is supposed to be 20-bytes long, but i get 40-bytes (possibly 2-byte hex?), and secondly, my modulus is in 2-byte hexadecimal format, but my exponents aren't.
Now i want to be able to manually encrypt messages, and decrypt messages (I have a special need for doing it manually) using the formula:
encrypt(T) = (T^E) mod PQ
T = result, E=public exponent, PQ = modulus.
so i think that i need to convert it to a decimal format?
such as the example from this site:
uses smaller exponents, and a smaller modulus, mine's much larger, i just need it to be an integer, or whatever type of number is used.