Re: [問題] invalid key format

看板java作者 (有些事,有時候。。。)時間10年前 (2014/01/06 07:06), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
: 客戶端的驗證部份則是想說用上面產生出來的公鑰跟簽章 : data一樣是用同樣的方法取得 : 但是publicKey及sign是複製產生的結果 : 丟到textField裡去抓 : 但產生invalid key format的例外錯誤 : 看網路上好像都是弄成der或pem的方式 : 不能直接用貼的嗎? 要經過轉換,或是你換一個 key reader 在研究 cloudfront signed url 時,看它的手冊有教轉換的方法 http://docs.aws.amazon.com/AmazonCloudFront/latest/ DeveloperGuide/private-content-trusted-signers.html 參考:Reformatting the CloudFront Private Key 不過,依它範例用到的 jets3t 後續的版本有提到轉換的工具 現在不用下指令,用它提供的類別就能轉了 http://jets3t.s3.amazonaws.com/api/ org/jets3t/service/security/EncryptionUtil.html #convertRsaPemToDer(java.io.InputStream) 你可以查看它的原始碼: https://bitbucket.org/jmurty/jets3t/wiki/Home 不過,我自己比較喜歡用 PEMReader 來做, 這是研究另一個 cloud provider 時,刻 api 時上網查到的方法 https://github.com/qrtt1/joyent.cloudapi/blob/master/ src/main/java/org/qty/joyent/Utils.java -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.115.102.149 ※ 編輯: qrtt1 來自: 59.115.102.149 (01/06 07:07)

01/06 19:48, , 1F
謝謝回答,我研究看看。
01/06 19:48, 1F
文章代碼(AID): #1IoULSUi (java)
討論串 (同標題文章)
文章代碼(AID): #1IoULSUi (java)