Redian新闻
>
怎样吧byte[]变成java.security.Key?
avatar
怎样吧byte[]变成java.security.Key?# Java - 爪哇娇娃
m*r
1
i get the binary bytes from somewhere, that is the key i am suppose to use
when i sign my document.
the api for javax.xml.crypto.dom.DOMCryptoContext wants a java.security.Key
object, not byte[]. but just looking at the api's, it's not clear to me how
i can go from one thing to the other. anyone can help?
thanks
avatar
g*g
2
http://java.sun.com/docs/books/tutorial/security/apisign/vstep2.html
private key is similar. However, private key is supposed to be kept
in keystore though.

Key
how

【在 m****r 的大作中提到】
: i get the binary bytes from somewhere, that is the key i am suppose to use
: when i sign my document.
: the api for javax.xml.crypto.dom.DOMCryptoContext wants a java.security.Key
: object, not byte[]. but just looking at the api's, it's not clear to me how
: i can go from one thing to the other. anyone can help?
: thanks

avatar
m*t
3

You need to ask that "somewhere" how to convert these bytes into a key. They
can be anything for all we know - exported ascii, raw bytes of a keystore
file, a serialized Key object, etc.

【在 m****r 的大作中提到】
: i get the binary bytes from somewhere, that is the key i am suppose to use
: when i sign my document.
: the api for javax.xml.crypto.dom.DOMCryptoContext wants a java.security.Key
: object, not byte[]. but just looking at the api's, it's not clear to me how
: i can go from one thing to the other. anyone can help?
: thanks

avatar
m*r
4
后来好像是这样解决的. 我自己implement一个MyKey class, 然后, 写 getEncoded().

They

【在 m******t 的大作中提到】
:
: You need to ask that "somewhere" how to convert these bytes into a key. They
: can be anything for all we know - exported ascii, raw bytes of a keystore
: file, a serialized Key object, etc.

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