PEMReader.java 文件源码

java
阅读 54 收藏 0 点赞 0 评论 0

项目:lams 作者:
/**
 * Read the PEM file and save the DER encoded octet
 * stream and begin marker.
 * 
 * @throws IOException
 */
protected void readFile() throws IOException {

    String  line;
    BufferedReader reader = new BufferedReader(
            new InputStreamReader(stream));
    try {
        while ((line = reader.readLine()) != null)
        {
            if (line.indexOf(BEGIN_MARKER) != -1)
            {
                beginMarker = line.trim();
                String endMarker = beginMarker.replace("BEGIN", "END");
                derBytes = readBytes(reader, endMarker);
                return;
            }
        }           
        throw new IOException("Invalid PEM file: no begin marker");
    } finally {
        reader.close();
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号