@Test public void testReadPrivateKey() throws Exception { PrivateKey privateKey = TokenUtils.readPrivateKey("/privateKey.pem"); System.out.println(privateKey); }
public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; }
TokenUtils { public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; } }
TokenUtils { public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; } private  TokenUtils(); }
TokenUtils { public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; } private  TokenUtils(); static String generateTokenString(String jsonResName); static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims); static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims, Map<String, Long> timeClaims); static PrivateKey readPrivateKey(String pemResName); static PublicKey readPublicKey(String pemResName); static KeyPair generateKeyPair(int keySize); static PrivateKey decodePrivateKey(String pemEncoded); static PublicKey decodePublicKey(String pemEncoded); }
TokenUtils { public static PrivateKey readPrivateKey(String pemResName) throws Exception { InputStream contentIS = TokenUtils.class.getResourceAsStream(pemResName); byte[] tmp = new byte[4096]; int length = contentIS.read(tmp); PrivateKey privateKey = decodePrivateKey(new String(tmp, 0, length)); return privateKey; } private  TokenUtils(); static String generateTokenString(String jsonResName); static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims); static String generateTokenString(String jsonResName, Set<InvalidClaims> invalidClaims, Map<String, Long> timeClaims); static PrivateKey readPrivateKey(String pemResName); static PublicKey readPublicKey(String pemResName); static KeyPair generateKeyPair(int keySize); static PrivateKey decodePrivateKey(String pemEncoded); static PublicKey decodePublicKey(String pemEncoded);  }