Having trouble decrypting in C# something encrypted on iPhone using RSA

后端 未结 4 1345
轻奢々
轻奢々 2021-02-03 13:00

I\'ve spent two days on this so far and combed through every source at my disposal, so this is the last resort.

I have an X509 certificate whose public key I have stored

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-03 13:26

    I believe you've answered the question yourself. The problem most certainly lies within the endianness.

    This is a possible way of writing two-way conversion methods:

    short convert_short(short in)
    {
     short out;
     char *p_in = (char *) ∈
     char *p_out = (char *) &out;
     p_out[0] = p_in[1];
     p_out[1] = p_in[0];  
     return out;
    }
    
    long convert_long(long in)
    {
     long out;
     char *p_in = (char *) ∈
     char *p_out = (char *) &out;
     p_out[0] = p_in[3];
     p_out[1] = p_in[2];
     p_out[2] = p_in[1];
     p_out[3] = p_in[0];  
     return out;
    } 
    

    This might be a good resource for you (other than wikipedia): http://betterexplained.com/articles/understanding-big-and-little-endian-byte-order/

提交回复
热议问题