get Test PEM - Java Security

Java examples for Security:Trust Manager

Description

get Test PEM

Demo Code

/*/*from  w  w w. ja va2  s .  co  m*/
 *  Copyright (c) 2012-2015 VMware, Inc.  All Rights Reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 *  use this file except in compliance with the License.  You may obtain a copy
 *  of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, without
 *  warranties or conditions of any kind, EITHER EXPRESS OR IMPLIED.  See the
 *  License for the specific language governing permissions and limitations
 *  under the License.
 */
//package com.java2s;

import java.io.IOException;

import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getTestPEM());
    }

    private static final String TEST_DATA_LOC = "src/test/resources/test_cert.pem";

    public static String getTestPEM() throws IOException {
        byte[] encoded = Files.readAllBytes(Paths.get(TEST_DATA_LOC));
        return new String(encoded, Charset.defaultCharset());
    }
}

Related Tutorials