blob: 192cd41e45ec0b7cffad8424d29a2dffb7d17aca [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>X509TestHelpers (Apache HBase 3.0.0-beta-1-SNAPSHOT Test API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="X509TestHelpers (Apache HBase 3.0.0-beta-1-SNAPSHOT Test API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":9,"i3":9,"i4":9,"i5":9,"i6":9,"i7":9,"i8":9,"i9":9,"i10":9,"i11":9,"i12":9,"i13":9,"i14":9,"i15":9,"i16":9,"i17":9,"i18":9,"i19":9,"i20":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/X509TestHelpers.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestContextProvider.CacheKey.html" title="class in org.apache.hadoop.hbase.io.crypto.tls"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html" target="_top">Frames</a></li>
<li><a href="X509TestHelpers.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.apache.hadoop.hbase.io.crypto.tls</div>
<h2 title="Class X509TestHelpers" class="title">Class X509TestHelpers</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>org.apache.hadoop.hbase.io.crypto.tls.X509TestHelpers</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@InterfaceAudience.Private
final class <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.82">X509TestHelpers</a>
extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre>
<div class="block">This class contains helper methods for creating X509 certificates and key pairs, and for
serializing them to JKS, PEM or other keystore type files.
<p/>
This file has been copied from the Apache ZooKeeper project.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href=
"https://github.com/apache/zookeeper/blob/c74658d398cdc1d207aa296cb6e20de00faec03e/zookeeper-server/src/test/java/org/apache/zookeeper/common/X509TestHelpers.java">Base
revision</a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#DEFAULT_ELLIPTIC_CURVE_NAME">DEFAULT_ELLIPTIC_CURVE_NAME</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#DEFAULT_RSA_KEY_SIZE_BITS">DEFAULT_RSA_KEY_SIZE_BITS</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#DEFAULT_RSA_PUB_EXPONENT">DEFAULT_RSA_PUB_EXPONENT</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#PRNG">PRNG</a></span></code>&nbsp;</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#SERIAL_NUMBER_MAX_BITS">SERIAL_NUMBER_MAX_BITS</a></span></code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier</th>
<th class="colLast" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>private </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#X509TestHelpers--">X509TestHelpers</a></span>()</code>&nbsp;</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>private static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#buildAndSignCertificate-java.security.PrivateKey-org.bouncycastle.cert.X509v3CertificateBuilder-">buildAndSignCertificate</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
org.bouncycastle.cert.X509v3CertificateBuilder&nbsp;builder)</code>
<div class="block">Signs the certificate being built by the given builder using the given private key and returns
the certificate.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certAndPrivateKeyToBCFKSBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">certAndPrivateKeyToBCFKSBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate and private key as a BCFKS KeyStore, optionally protecting
the private key (and possibly the cert?) with a password.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>private static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certAndPrivateKeyToBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-java.security.KeyStore-">certAndPrivateKeyToBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyStore.html?is-external=true" title="class or interface in java.security">KeyStore</a>&nbsp;keyStore)</code>&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certAndPrivateKeyToJavaKeyStoreBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">certAndPrivateKeyToJavaKeyStoreBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate and private key as a JKS KeyStore, optionally protecting the
private key (and possibly the cert?) with a password.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certAndPrivateKeyToPKCS12Bytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">certAndPrivateKeyToPKCS12Bytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate and private key as a PKCS12 KeyStore, optionally protecting
the private key (and possibly the cert?) with a password.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certToBCFKSTrustStoreBytes-java.security.cert.X509Certificate-char:A-">certToBCFKSTrustStoreBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate as a BCFKS TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret).</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certToJavaTrustStoreBytes-java.security.cert.X509Certificate-char:A-">certToJavaTrustStoreBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate as a JKS TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret).</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certToPKCS12TrustStoreBytes-java.security.cert.X509Certificate-char:A-">certToPKCS12TrustStoreBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)</code>
<div class="block">Encodes the given X509Certificate as a PKCS12 TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret).</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>private static byte[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#certToTrustStoreBytes-java.security.cert.X509Certificate-char:A-java.security.KeyStore-">certToTrustStoreBytes</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyStore.html?is-external=true" title="class or interface in java.security">KeyStore</a>&nbsp;trustStore)</code>&nbsp;</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#generateECKeyPair--">generateECKeyPair</a></span>()</code>
<div class="block">Generates an elliptic curve key pair using the "secp256r1" aka "prime256v1" aka "NIST P-256"
curve.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#generateKeyPair-org.apache.hadoop.hbase.io.crypto.tls.X509KeyType-">generateKeyPair</a></span>(<a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509KeyType.html" title="enum in org.apache.hadoop.hbase.io.crypto.tls">X509KeyType</a>&nbsp;keyType)</code>
<div class="block">Generates a new asymmetric key pair of the given type.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#generateRSAKeyPair--">generateRSAKeyPair</a></span>()</code>
<div class="block">Generates an RSA key pair with a 2048-bit private key and F4 (65537) as the public exponent.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>private static org.bouncycastle.asn1.x509.GeneralNames</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#getLocalhostSubjectAltNames--">getLocalhostSubjectAltNames</a></span>()</code>
<div class="block">Returns subject alternative names for "localhost".</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>private static org.bouncycastle.cert.X509v3CertificateBuilder</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#initCertBuilder-org.bouncycastle.asn1.x500.X500Name-java.time.LocalDate-java.time.LocalDate-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-">initCertBuilder</a></span>(org.bouncycastle.asn1.x500.X500Name&nbsp;issuer,
<a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html?is-external=true" title="class or interface in java.time">LocalDate</a>&nbsp;notBefore,
<a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html?is-external=true" title="class or interface in java.time">LocalDate</a>&nbsp;notAfter,
org.bouncycastle.asn1.x500.X500Name&nbsp;subject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;subjectPublicKey)</code>
<div class="block">Helper method for newSelfSignedCACert() and newCert().</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#newCert-java.security.cert.X509Certificate-java.security.KeyPair-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-">newCert</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;caCert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;caKeyPair,
org.bouncycastle.asn1.x500.X500Name&nbsp;certSubject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;certPublicKey)</code>
<div class="block">Using the private key of the given CA key pair and the Subject of the given CA cert as the
Issuer, issues a new cert with the given subject and public key.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#newCert-java.security.cert.X509Certificate-java.security.KeyPair-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-org.bouncycastle.asn1.x509.GeneralNames-">newCert</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;caCert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;caKeyPair,
org.bouncycastle.asn1.x500.X500Name&nbsp;certSubject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;certPublicKey,
org.bouncycastle.asn1.x509.GeneralNames&nbsp;subjectAltNames)</code>
<div class="block">Using the private key of the given CA key pair and the Subject of the given CA cert as the
Issuer, issues a new cert with the given subject and public key.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#newSelfSignedCACert-org.bouncycastle.asn1.x500.X500Name-java.security.KeyPair-">newSelfSignedCACert</a></span>(org.bouncycastle.asn1.x500.X500Name&nbsp;subject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;keyPair)</code>
<div class="block">Uses the private key of the given key pair to create a self-signed CA certificate with the
public half of the key pair and the given subject and expiration.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#pemEncodeCertAndPrivateKey-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">pemEncodeCertAndPrivateKey</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)</code>
<div class="block">PEM-encodes the given X509 certificate and private key (compatible with OpenSSL), optionally
protecting the private key with a password.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#pemEncodePrivateKey-java.security.PrivateKey-char:A-">pemEncodePrivateKey</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;key,
char[]&nbsp;password)</code>
<div class="block">PEM-encodes the given private key (compatible with OpenSSL), optionally protecting it with a
password, and returns the result as a String.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#pemEncodeX509Certificate-java.security.cert.X509Certificate-">pemEncodeX509Certificate</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert)</code>
<div class="block">PEM-encodes the given X509 certificate (compatible with OpenSSL) and returns the result as a
String.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#toX509Cert-org.bouncycastle.cert.X509CertificateHolder-">toX509Cert</a></span>(org.bouncycastle.cert.X509CertificateHolder&nbsp;certHolder)</code>
<div class="block">Convenience method to convert a bouncycastle X509CertificateHolder to a java X509Certificate.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="PRNG">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>PRNG</h4>
<pre>private static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/SecureRandom.html?is-external=true" title="class or interface in java.security">SecureRandom</a> <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.84">PRNG</a></pre>
</li>
</ul>
<a name="DEFAULT_RSA_KEY_SIZE_BITS">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_RSA_KEY_SIZE_BITS</h4>
<pre>private static final&nbsp;int <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.85">DEFAULT_RSA_KEY_SIZE_BITS</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../../constant-values.html#org.apache.hadoop.hbase.io.crypto.tls.X509TestHelpers.DEFAULT_RSA_KEY_SIZE_BITS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="DEFAULT_RSA_PUB_EXPONENT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_RSA_PUB_EXPONENT</h4>
<pre>private static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</a> <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.86">DEFAULT_RSA_PUB_EXPONENT</a></pre>
</li>
</ul>
<a name="DEFAULT_ELLIPTIC_CURVE_NAME">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DEFAULT_ELLIPTIC_CURVE_NAME</h4>
<pre>private static final&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.87">DEFAULT_ELLIPTIC_CURVE_NAME</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../../constant-values.html#org.apache.hadoop.hbase.io.crypto.tls.X509TestHelpers.DEFAULT_ELLIPTIC_CURVE_NAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="SERIAL_NUMBER_MAX_BITS">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>SERIAL_NUMBER_MAX_BITS</h4>
<pre>private static final&nbsp;int <a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.90">SERIAL_NUMBER_MAX_BITS</a></pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../../constant-values.html#org.apache.hadoop.hbase.io.crypto.tls.X509TestHelpers.SERIAL_NUMBER_MAX_BITS">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="X509TestHelpers--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>X509TestHelpers</h4>
<pre>private&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.469">X509TestHelpers</a>()</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="newSelfSignedCACert-org.bouncycastle.asn1.x500.X500Name-java.security.KeyPair-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newSelfSignedCACert</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.103">newSelfSignedCACert</a>(org.bouncycastle.asn1.x500.X500Name&nbsp;subject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;keyPair)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Uses the private key of the given key pair to create a self-signed CA certificate with the
public half of the key pair and the given subject and expiration. The issuer of the new cert
will be equal to the subject. Returns the new certificate. The returned certificate should be
used as the trust store. The private key of the input key pair should be used to sign
certificates that are used by test peers to establish TLS connections to each other.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>subject</code> - the subject of the new certificate being created.</dd>
<dd><code>keyPair</code> - the key pair to use. The public key will be embedded in the new certificate, and
the private key will be used to self-sign the certificate.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new self-signed CA certificate.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="newCert-java.security.cert.X509Certificate-java.security.KeyPair-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newCert</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.127">newCert</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;caCert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;caKeyPair,
org.bouncycastle.asn1.x500.X500Name&nbsp;certSubject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;certPublicKey)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Using the private key of the given CA key pair and the Subject of the given CA cert as the
Issuer, issues a new cert with the given subject and public key. The returned certificate,
combined with the private key half of the <code>certPublicKey</code>, should be used as the key
store.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>caCert</code> - the certificate of the CA that's doing the signing.</dd>
<dd><code>caKeyPair</code> - the key pair of the CA. The private key will be used to sign. The public
key must match the public key in the <code>caCert</code>.</dd>
<dd><code>certSubject</code> - the subject field of the new cert being issued.</dd>
<dd><code>certPublicKey</code> - the public key of the new cert being issued.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new certificate signed by the CA's private key.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="newCert-java.security.cert.X509Certificate-java.security.KeyPair-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-org.bouncycastle.asn1.x509.GeneralNames-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>newCert</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.146">newCert</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;caCert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;caKeyPair,
org.bouncycastle.asn1.x500.X500Name&nbsp;certSubject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;certPublicKey,
org.bouncycastle.asn1.x509.GeneralNames&nbsp;subjectAltNames)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Using the private key of the given CA key pair and the Subject of the given CA cert as the
Issuer, issues a new cert with the given subject and public key. The returned certificate,
combined with the private key half of the <code>certPublicKey</code>, should be used as the key
store.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>caCert</code> - the certificate of the CA that's doing the signing.</dd>
<dd><code>caKeyPair</code> - the key pair of the CA. The private key will be used to sign. The public
key must match the public key in the <code>caCert</code>.</dd>
<dd><code>certSubject</code> - the subject field of the new cert being issued.</dd>
<dd><code>certPublicKey</code> - the public key of the new cert being issued.</dd>
<dd><code>subjectAltNames</code> - the subject alternative names to use, or null if none</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a new certificate signed by the CA's private key.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="getLocalhostSubjectAltNames--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getLocalhostSubjectAltNames</h4>
<pre>private static&nbsp;org.bouncycastle.asn1.x509.GeneralNames&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.172">getLocalhostSubjectAltNames</a>()
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/net/UnknownHostException.html?is-external=true" title="class or interface in java.net">UnknownHostException</a></pre>
<div class="block">Returns subject alternative names for "localhost".</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the subject alternative names for "localhost".</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/net/UnknownHostException.html?is-external=true" title="class or interface in java.net">UnknownHostException</a></code></dd>
</dl>
</li>
</ul>
<a name="initCertBuilder-org.bouncycastle.asn1.x500.X500Name-java.time.LocalDate-java.time.LocalDate-org.bouncycastle.asn1.x500.X500Name-java.security.PublicKey-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>initCertBuilder</h4>
<pre>private static&nbsp;org.bouncycastle.cert.X509v3CertificateBuilder&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.195">initCertBuilder</a>(org.bouncycastle.asn1.x500.X500Name&nbsp;issuer,
<a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html?is-external=true" title="class or interface in java.time">LocalDate</a>&nbsp;notBefore,
<a href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html?is-external=true" title="class or interface in java.time">LocalDate</a>&nbsp;notAfter,
org.bouncycastle.asn1.x500.X500Name&nbsp;subject,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PublicKey.html?is-external=true" title="class or interface in java.security">PublicKey</a>&nbsp;subjectPublicKey)</pre>
<div class="block">Helper method for newSelfSignedCACert() and newCert(). Initializes a X509v3CertificateBuilder
with logic that's common to both methods.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>issuer</code> - Issuer field of the new cert.</dd>
<dd><code>notBefore</code> - date before which the new cert is not valid.</dd>
<dd><code>notAfter</code> - date after which the new cert is not valid.</dd>
<dd><code>subject</code> - Subject field of the new cert.</dd>
<dd><code>subjectPublicKey</code> - public key to store in the new cert.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a X509v3CertificateBuilder that can be further customized to finish creating the new
cert.</dd>
</dl>
</li>
</ul>
<a name="buildAndSignCertificate-java.security.PrivateKey-org.bouncycastle.cert.X509v3CertificateBuilder-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>buildAndSignCertificate</h4>
<pre>private static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.209">buildAndSignCertificate</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
org.bouncycastle.cert.X509v3CertificateBuilder&nbsp;builder)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/CertificateException.html?is-external=true" title="class or interface in java.security.cert">CertificateException</a></pre>
<div class="block">Signs the certificate being built by the given builder using the given private key and returns
the certificate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>privateKey</code> - the private key to sign the certificate with.</dd>
<dd><code>builder</code> - the cert builder that contains the certificate data.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the signed certificate.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/CertificateException.html?is-external=true" title="class or interface in java.security.cert">CertificateException</a></code></dd>
</dl>
</li>
</ul>
<a name="generateKeyPair-org.apache.hadoop.hbase.io.crypto.tls.X509KeyType-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateKeyPair</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.238">generateKeyPair</a>(<a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509KeyType.html" title="enum in org.apache.hadoop.hbase.io.crypto.tls">X509KeyType</a>&nbsp;keyType)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Generates a new asymmetric key pair of the given type.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>keyType</code> - the type of key pair to generate.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the new key pair.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code> - if your java crypto providers are messed up.</dd>
</dl>
</li>
</ul>
<a name="generateRSAKeyPair--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateRSAKeyPair</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.253">generateRSAKeyPair</a>()
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Generates an RSA key pair with a 2048-bit private key and F4 (65537) as the public exponent.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the key pair.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="generateECKeyPair--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>generateECKeyPair</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyPair.html?is-external=true" title="class or interface in java.security">KeyPair</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.266">generateECKeyPair</a>()
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Generates an elliptic curve key pair using the "secp256r1" aka "prime256v1" aka "NIST P-256"
curve.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the key pair.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="pemEncodeCertAndPrivateKey-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pemEncodeCertAndPrivateKey</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.285">pemEncodeCertAndPrivateKey</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException</pre>
<div class="block">PEM-encodes the given X509 certificate and private key (compatible with OpenSSL), optionally
protecting the private key with a password. Concatenates them both and returns the result as a
single string. This creates the PEM encoding of a key store.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the X509 certificate to PEM-encode.</dd>
<dd><code>privateKey</code> - the private key to PEM-encode.</dd>
<dd><code>keyPassword</code> - an optional key password. If empty or null, the private key will not be
encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a String containing the PEM encodings of the certificate and private key.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if converting the certificate or private key to PEM format
fails.</dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code> - if constructing the encryptor from the given password fails.</dd>
</dl>
</li>
</ul>
<a name="pemEncodePrivateKey-java.security.PrivateKey-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pemEncodePrivateKey</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.300">pemEncodePrivateKey</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;key,
char[]&nbsp;password)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
org.bouncycastle.operator.OperatorCreationException</pre>
<div class="block">PEM-encodes the given private key (compatible with OpenSSL), optionally protecting it with a
password, and returns the result as a String.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>key</code> - the private key.</dd>
<dd><code>password</code> - an optional key password. If empty or null, the private key will not be
encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a String containing the PEM encoding of the private key.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if converting the key to PEM format fails.</dd>
<dd><code>org.bouncycastle.operator.OperatorCreationException</code> - if constructing the encryptor from the given password fails.</dd>
</dl>
</li>
</ul>
<a name="pemEncodeX509Certificate-java.security.cert.X509Certificate-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>pemEncodeX509Certificate</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.323">pemEncodeX509Certificate</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block">PEM-encodes the given X509 certificate (compatible with OpenSSL) and returns the result as a
String.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the certificate.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a String containing the PEM encoding of the certificate.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - if converting the certificate to PEM format fails.</dd>
</dl>
</li>
</ul>
<a name="certToJavaTrustStoreBytes-java.security.cert.X509Certificate-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certToJavaTrustStoreBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.342">certToJavaTrustStoreBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate as a JKS TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret). Returns the byte array encoding of the trust
store, which may be written to a file and loaded to instantiate the trust store at a later
point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the certificate to serialize.</dd>
<dd><code>keyPassword</code> - an optional password to encrypt the trust store. If empty or null, the cert
will not be encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the JKS trust store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certToPKCS12TrustStoreBytes-java.security.cert.X509Certificate-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certToPKCS12TrustStoreBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.359">certToPKCS12TrustStoreBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate as a PKCS12 TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret). Returns the byte array encoding of the trust
store, which may be written to a file and loaded to instantiate the trust store at a later
point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the certificate to serialize.</dd>
<dd><code>keyPassword</code> - an optional password to encrypt the trust store. If empty or null, the cert
will not be encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the PKCS12 trust store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certToBCFKSTrustStoreBytes-java.security.cert.X509Certificate-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certToBCFKSTrustStoreBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.376">certToBCFKSTrustStoreBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate as a BCFKS TrustStore, optionally protecting the cert with a
password (though it's unclear why one would do this since certificates only contain public
information and do not need to be kept secret). Returns the byte array encoding of the trust
store, which may be written to a file and loaded to instantiate the trust store at a later
point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the certificate to serialize.</dd>
<dd><code>keyPassword</code> - an optional password to encrypt the trust store. If empty or null, the cert
will not be encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the BCFKS trust store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certToTrustStoreBytes-java.security.cert.X509Certificate-char:A-java.security.KeyStore-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certToTrustStoreBytes</h4>
<pre>private static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.382">certToTrustStoreBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
char[]&nbsp;keyPassword,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyStore.html?is-external=true" title="class or interface in java.security">KeyStore</a>&nbsp;trustStore)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certAndPrivateKeyToJavaKeyStoreBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certAndPrivateKeyToJavaKeyStoreBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.405">certAndPrivateKeyToJavaKeyStoreBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate and private key as a JKS KeyStore, optionally protecting the
private key (and possibly the cert?) with a password. Returns the byte array encoding of the
key store, which may be written to a file and loaded to instantiate the key store at a later
point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the X509 certificate to serialize.</dd>
<dd><code>privateKey</code> - the private key to serialize.</dd>
<dd><code>keyPassword</code> - an optional key password. If empty or null, the private key will not be
encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the JKS key store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certAndPrivateKeyToPKCS12Bytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certAndPrivateKeyToPKCS12Bytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.422">certAndPrivateKeyToPKCS12Bytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate and private key as a PKCS12 KeyStore, optionally protecting
the private key (and possibly the cert?) with a password. Returns the byte array encoding of
the key store, which may be written to a file and loaded to instantiate the key store at a
later point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the X509 certificate to serialize.</dd>
<dd><code>privateKey</code> - the private key to serialize.</dd>
<dd><code>keyPassword</code> - an optional key password. If empty or null, the private key will not be
encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the PKCS12 key store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certAndPrivateKeyToBCFKSBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certAndPrivateKeyToBCFKSBytes</h4>
<pre>public static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.439">certAndPrivateKeyToBCFKSBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<div class="block">Encodes the given X509Certificate and private key as a BCFKS KeyStore, optionally protecting
the private key (and possibly the cert?) with a password. Returns the byte array encoding of
the key store, which may be written to a file and loaded to instantiate the key store at a
later point or in another process.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>cert</code> - the X509 certificate to serialize.</dd>
<dd><code>privateKey</code> - the private key to serialize.</dd>
<dd><code>keyPassword</code> - an optional key password. If empty or null, the private key will not be
encrypted.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the serialized bytes of the BCFKS key store.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="certAndPrivateKeyToBytes-java.security.cert.X509Certificate-java.security.PrivateKey-char:A-java.security.KeyStore-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>certAndPrivateKeyToBytes</h4>
<pre>private static&nbsp;byte[]&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.445">certAndPrivateKeyToBytes</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;cert,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/PrivateKey.html?is-external=true" title="class or interface in java.security">PrivateKey</a>&nbsp;privateKey,
char[]&nbsp;keyPassword,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/KeyStore.html?is-external=true" title="class or interface in java.security">KeyStore</a>&nbsp;keyStore)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html?is-external=true" title="class or interface in java.security">GeneralSecurityException</a></code></dd>
</dl>
</li>
</ul>
<a name="toX509Cert-org.bouncycastle.cert.X509CertificateHolder-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toX509Cert</h4>
<pre>public static&nbsp;<a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/X509Certificate.html?is-external=true" title="class or interface in java.security.cert">X509Certificate</a>&nbsp;<a href="../../../../../../../src-html/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html#line.463">toX509Cert</a>(org.bouncycastle.cert.X509CertificateHolder&nbsp;certHolder)
throws <a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/CertificateException.html?is-external=true" title="class or interface in java.security.cert">CertificateException</a></pre>
<div class="block">Convenience method to convert a bouncycastle X509CertificateHolder to a java X509Certificate.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>certHolder</code> - a bouncycastle X509CertificateHolder.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>a java X509Certificate</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/security/cert/CertificateException.html?is-external=true" title="class or interface in java.security.cert">CertificateException</a></code> - if the conversion fails.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/X509TestHelpers.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../../org/apache/hadoop/hbase/io/crypto/tls/X509TestContextProvider.CacheKey.html" title="class in org.apache.hadoop.hbase.io.crypto.tls"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li>Next&nbsp;Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../../../../index.html?org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.html" target="_top">Frames</a></li>
<li><a href="X509TestHelpers.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2007&#x2013;2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>