質問

I have a problem and spent the last two days searching for an answers.

I generated a DH Object with OpenSSL in C (more specific Objective-C, but I think there isn't something like that) and now can access the p,q and publickey values that are Bignums. I need to send these values as ASN.1 DER Encoding to a server as one base64 string.

On the Android Client the important step is .getPublic().getEncoded() followed by a base64 Encoding. ( is something with a keyagreement or so)

How can I do that on c or objective-c? Code examples would be very very great.

役に立ちましたか?

解決

For DER encoding, you can i2d_DHParams may solve your purpose.

Suppose you have DH parameters in dh, then you can call

  int len;
  len  = i2d_DHParams (dh, &buf);
  //It should write encoded dh to buf and len should be number of bytes written.

You can see DH methods here.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top