Hi!
~~~

On 02/17/2012 12:37 AM, Tankred Hase wrote:
>
> Hi Carsten, thanks for your reply.
>
> > Well, a very easy way to do this is to abstract the symmetric encryption / 
> > decryption routine (openpgp_crypto_symmetricEncrypt and 
> > openpgp_crypto_symmetricDecrypt) into a worker. These functions are not 
> > requiring any additional secure random or reading from the storage so a 
> > worker wrapper implementation should be straightforward.
>
> When profiling the encryption of a 700kb file only about 4% of the time is 
> spent in openpgpg_crypto_symmetricEncrypt. About 27% is spent in createcrc24.
>

Wow, ok. We need a better crc24 implementation. The crc24 checksum is 
calculated over the data encoded in base64. The checksum is at the end of each 
"ascii armored" pgp block encoded in base64. In the early days this was used 
for verifying integrity of the encrypted data. In RFC4880 the Modification 
Detection Code Packet (Tag 19) and the Sym. Encrypted Integrity Protected Data 
Packet (Tag 18) have been introduced allowing a integrity protection based on a 
sha1 hash stored in the tag 19 packet. If 
openpgp.config.config.integrity_protect is set to true openpgpjs generates 
these two packets.

I would suggest to remove the getCheckSum() and verifyCheckSum() from 
openpgp_encoding_deArmor / openpgp_encoding_armor in 
src/encoding/openpgp.encoding.asciiarmor.js within your code.


> > Another problem of the current implementation with big impact on 
> > performance is the conversion between byte (int 0-255) array and string. I 
> > often made use of the two conversion functions bin2str and str2bin to feed 
> > data in the correct format into libraries. I think we should internally 
> > change this behavior to only using arrays of integers after base64 decoding 
> > has been done.
>
> Im passing files in the form of a base64 encoded dataUrl to 
> openpgp.write_encrypted_message. What would be the best input type im terms 
> of performance?
>

openpgp.write_encrypted_message only accepts strings as data input. The comment 
on arrays vs. strings and conversion described an internal behavior of the 
implementation.

regards,
carsten

_______________________________________________

http://openpgpjs.org

Reply via email to