code: public static PublicKey loadPublicKey(InputStream in) {  
          try {  
              BufferedReader br= new BufferedReader(new InputStreamReader(in));  
              String readLine= null;  
              StringBuilder sb= new StringBuilder();  
              while((readLine= br.readLine())!=null){  
                  if(readLine.charAt(0)=='-'){  
                      continue;  
                  }else{  
                      sb.append(readLine);  
                      sb.append('\r');  
                  }  
              }  
              byte[] bytes = Base64.decode(sb.toString());
              return loadPublicKey(bytes);  
          } catch (IOException e) {  
              throw new RuntimeException("公钥数据流读取错误");  
          } catch (NullPointerException e) {  
              throw new RuntimeException("公钥输入流为空");  
          } 
      }
docs: 从文件中输入流中加载公钥
  @param in 公钥输入流