English 中文(简体)
如何将RSA置于高潮之上?
原标题:How to send RSA open key over tcp?

So, the question is how to correctly make a binary data of RSA *rsa key? I do

RSA *rsa = RSA_generate_key(2048, 65537, 0, 0);
uchar *pp = (uchar *)malloc(2560);
int bytes = i2d_RSAPublicKey(rsa, &pp);
write(client, pp, bytes);

和对应的2i_RSAPublicKey和节目坠毁。 什么是错了?

最佳回答

Don t malloc pp yourself, 相反地将其定为NUL。 i2d_RSAPublicKey, do the malloc for You and set pp to point to the new malloced public key.

问题回答

暂无回答




相关问题
Checking a local TCP port is not open in Java

Is there a simple way to make sure that a local port is not already open. Some TCP socket servers (eg Grizzly) don t seem to do this check by default. When this check is missing, the server appears ...

Client/Server: Integer always received as 1 (C-programming)

I m building a client and a server program that exchanges data over TCP and I m having trouble sending an ACK-confirmation from the server back to the client when an operation is successfull. I ve ...

Long Lived Persistent TCP Connection on the Android

I ve read some articles on the web and some questions on StackOverFlow, but no one seems to have a definite answer over a) If google uses Long Lived TCP connections for Gmail, Mail etc, and b) If ...

Maintaining many socket connections with a single thread

Many tutorials on socket communication I see seem to use 1 thread per socket. But on a server used for online gaming, you might have 10k concurrent users - 10k threads isn t probably a wonderful idea. ...

SSL_accept with blocking socket

I made a server with SSL and blocking sockets. When I connect with telnet (so it does not do the handshake), the SSL_accept blocks indefinitely and blocks every new handshake/accept (and by definition ...

How to list all devices in my wifi range in iphone

I am using the reachability code from apple to find if my iphone is connected to the wifi. Next i would like to list all the devices that are in my wifi range. How should i do this. The other devices ...

Sending struct over TCP (C-programming)

I have a client and server program where I want to send an entire struct from the client and then output the struct member "ID" on the server. I have done all the connecting etc and already managed ...

Idle tcp file descriptor after failed connect on HPUX

I have a client tcp socket (in c++) that has a loop where it retries to open a socket and connect to a server at a certain interval until it succeeds. A bug in the program caused close not to be ...

热门标签