avatar
如何传递secret key# Java - 爪哇娇娃
j*1
1
【 以下文字转载自 Complain 讨论区 】
发信人: mitbbs (未名空间), 信区: Complain
标 题: Re: [投诉]TrustinJesus版主Dignity两天之内狂删我19篇主题帖
发信站: BBS 未名空间站 (Tue Jun 28 02:58:38 2011, 美东)
由于版内炸版,会引起误删。版主可恢复其误删的帖子
avatar
q*u
2
在分布式的环境中,client
和server需要采用加密的方式传递信息。我的问题是如果用shared secret
key,我在server上生成了这个key,那么如何让client端安全地得到这个key来解密收到的
信息呢?
谢谢!
avatar
m*t
3

I suppose the transportation of the key in this case must be
outside your system. Whoever operates the client would need to supply
the key - isn't that the whole idea of having a key?

【在 q****u 的大作中提到】
: 在分布式的环境中,client
: 和server需要采用加密的方式传递信息。我的问题是如果用shared secret
: key,我在server上生成了这个key,那么如何让client端安全地得到这个key来解密收到的
: 信息呢?
: 谢谢!

avatar
q*u
4
实际上我原来是想在system里做这些事情,并不需要操作者提供这个key.现在想换一种方
式,在server产生key,用什么方式把它存在一个文件里,然后把这个文件再放到client的
机器上,由client端程序从文件里读取这个key,用java可行吗?

到的

【在 m******t 的大作中提到】
:
: I suppose the transportation of the key in this case must be
: outside your system. Whoever operates the client would need to supply
: the key - isn't that the whole idea of having a key?

avatar
m*t
5

You can certainly do this in Java.

【在 q****u 的大作中提到】
: 实际上我原来是想在system里做这些事情,并不需要操作者提供这个key.现在想换一种方
: 式,在server产生key,用什么方式把它存在一个文件里,然后把这个文件再放到client的
: 机器上,由client端程序从文件里读取这个key,用java可行吗?
:
: 到的

avatar
c*t
6
Use public-key to encrypt the secret key and decode the key using private
key at the client side.

【在 q****u 的大作中提到】
: 在分布式的环境中,client
: 和server需要采用加密的方式传递信息。我的问题是如果用shared secret
: key,我在server上生成了这个key,那么如何让client端安全地得到这个key来解密收到的
: 信息呢?
: 谢谢!

avatar
q*u
7
我的问题是如何让client得到这个key呢,
比如说,我在server端的程序里产生了一个share key,用来加密和解密,可是我怎样把这
个key import
出去传递给client呢,它又不是一个字符串,我怎么才能让client端得到exactly the
same key.

到的

【在 c*****t 的大作中提到】
: Use public-key to encrypt the secret key and decode the key using private
: key at the client side.

avatar
c*t
8
Your server can send the key to the client right? (Otherwise, why call it
a server?)
If representation is your problem. A lazy way is to serialize your java
object into byte array and then send this byte array to client. At the
client side, if it is java based as well, the client may serialize it back
into Java object from the byte stream. In order to use java serialization,
make sure all instance objects implements Serializable.

【在 q****u 的大作中提到】
: 我的问题是如何让client得到这个key呢,
: 比如说,我在server端的程序里产生了一个share key,用来加密和解密,可是我怎样把这
: 个key import
: 出去传递给client呢,它又不是一个字符串,我怎么才能让client端得到exactly the
: same key.
:
: 到的

avatar
b*s
9
if you transport this key without any encrpytion, what's the point
to use encryption on you messages?
why not use public key encryption like rsa, dh? java has a security package
that can do many stuff for you.

【在 q****u 的大作中提到】
: 在分布式的环境中,client
: 和server需要采用加密的方式传递信息。我的问题是如果用shared secret
: key,我在server上生成了这个key,那么如何让client端安全地得到这个key来解密收到的
: 信息呢?
: 谢谢!

avatar
R*r
10
A simple way to do this:
1. client authenticate itself with the server
2. client send its public key K to the server
3. the server generate the symmetric secret key n
4. the server encrypt n using K and send the result K(n) to the client
5. the client decrypt K(n) using its own private key, and get n
Of course, this simple method is vunerable to many attacks.
There are more sophisticated protocols that you can find on the internet.

【在 q****u 的大作中提到】
: 我的问题是如何让client得到这个key呢,
: 比如说,我在server端的程序里产生了一个share key,用来加密和解密,可是我怎样把这
: 个key import
: 出去传递给client呢,它又不是一个字符串,我怎么才能让client端得到exactly the
: same key.
:
: 到的

avatar
b*o
11
Use Key-Exchange Protocol. The output of my Java program is the following:
gilels-46 project>: java KeyExchange
Step 1: Initialize keys
Please enter the public key p:
129229
Please enter the public key a:
128669
Please enter A's private key k:
100003
Please enter B's private key l:
100019
Step 2: Exchange keys
The number x that A sends to B is 127022. (x=a^k mod p)
The number y that B sends to A is 1027. (x=a^l mod p)
Step 3: Decode keys
The key that A get is 51870. (c=y^k mod p)
The key that B

【在 q****u 的大作中提到】
: 我的问题是如何让client得到这个key呢,
: 比如说,我在server端的程序里产生了一个share key,用来加密和解密,可是我怎样把这
: 个key import
: 出去传递给client呢,它又不是一个字符串,我怎么才能让client端得到exactly the
: same key.
:
: 到的

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。