Package com.adito.security.pki

Examples of com.adito.security.pki.SshPrivateKey


   
    if(!hasLoadedKey(username))
      throw new PrivateKeyNotInitializedException();
   
    try {
      SshPrivateKey pk = (SshPrivateKey) loadedPrivateKeys.get(username);
     
     
      StringTokenizer blocks = new StringTokenizer(text, "\n");
     
      String plainText = "";
     
     
      while(blocks.hasMoreTokens()) {
        Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
       
        cipher.init(Cipher.DECRYPT_MODE, pk.getPrivateKey());
       
        byte[] encrypted = Base64.decode(blocks.nextToken());
        byte[] ctext = cipher.doFinal(encrypted);
       
        plainText += new String(ctext);
View Full Code Here


  protected SshPrivateKey getPrivateKey(String username, String passphrase) throws IOException, InvalidKeyException {
   
    if(loadedPrivateKeys.containsKey(username))
      return (SshPrivateKey) loadedPrivateKeys.get(username);
   
    SshPrivateKey pk = getPrivateKeyFromStore(username, passphrase);
   
    loadedPrivateKeys.put(username, pk);
   
    return pk;
 
View Full Code Here

TOP

Related Classes of com.adito.security.pki.SshPrivateKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.