static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[0]); }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }
static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[0]); }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }
static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[0]); }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }
static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[certs.size()]); }
static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[0]); }
static ByteBuf[] readCertificates(InputStream in) throws CertificateException { String content; try { content = readContent(in); } catch (IOException e) { throw new CertificateException("failed to read certificate input stream", e); } List<ByteBuf> certs = new ArrayList<ByteBuf>(); Matcher m = CERT_PATTERN.matcher(content); int start = 0; for (;;) { if (!m.find(start)) { break; } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); certs.add(der); start = m.end(); } if (certs.isEmpty()) { throw new CertificateException("found no certificates in input stream"); } return certs.toArray(new ByteBuf[certs.size()]); }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }
static ByteBuf readPrivateKey(InputStream in) throws KeyException { String content; try { content = readContent(in); } catch (IOException e) { throw new KeyException("failed to read key input stream", e); } Matcher m = KEY_PATTERN.matcher(content); if (!m.find()) { throw new KeyException("could not find a PKCS #8 private key in input stream" + " (see http://netty.io/wiki/sslcontextbuilder-and-private-key.html for more information)"); } ByteBuf base64 = Unpooled.copiedBuffer(m.group(1), CharsetUtil.US_ASCII); ByteBuf der = Base64.decode(base64); base64.release(); return der; }