Crypto++ RSA從字符串讀取公私匙

string and StringSource (load):

 
  1.  
    string spki = ...;
  2.  
    StringSource ss(spki, true /*pumpAll*/);
  3.  
     
  4.  
    RSA::PublicKey publicKey;
  5.  
    publicKey.Load(ss);
 

vector and ArraySource (load):

 
  1.  
    vector<byte> spki = ...;
  2.  
    ArraySource as(&spki[0], spki.length(), true /*pumpAll*/);
  3.  
     
  4.  
    RSA::PublicKey publicKey;
  5.  
    publicKey.Load(as);
 

string and StringSink (save)

 
  1.  
    string spki;
  2.  
    StringSink ss(spki);
  3.  
     
  4.  
    RSA::PublicKey publicKey(...);
  5.  
    publicKey.Save(ss);
 
 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章