On 03/23/2011 06:24 AM, Superpacko wrote: > Well, so i 've been told that i shuld be able to extract the MPI as > bytes and pass it to NSS since GPG original key format is PEM, i > should be able to use MPIs data as raw bytes. If it's really PEM (which should be a printable string), then you should be able to pull out the Base 64 portion and pass it to the NSS atob routine:
ATOB_ConvertAsciiToItem() It will return a secItem which has a date and a length. This secitem is DER data. bob PEM is an ascii file in which all the data outside specific wrappers: ( ------------------------- BEGIN xxxxx ---------------------------------), (---------------------- END xxx ------------------------) are ignored. Inside the wrappers is base 64 encoded binary. Base 64 takes the 27 letters of the alphabet, both upper and lower case, with the 10 digits, plus and / and assigns each a value between 0 and 64. The binary blob is then considered a long binary integer. That integer is converted to base 64 using those printable digits. The encoding used 4 base 64 digits to encode 3 binary bytes (base 64 is 6 bits per value) The PEM base64 pem data is DER data, so the nss der functions should work for them, once you've decoded the base 64. bob > The thing is that the only function i found that takes unsigned char* > as argument is PK11_MakeKEAPubKey, and when i try to encrypt using > that key, i get error 8178 (BAD KEY) > So is there a way to import a public and private key with raw bytes? > so far i've seen that most functions need SECKEYPrivateKeyInfo and > stuff like that.
-- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto