react-native-rsa-native
Version:
A native implementation of RSA key generation and encryption/decryption.
748 lines (732 loc) • 75 kB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Lint Report</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.blue-indigo.min.css" />
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,500,700" type="text/css">
<script defer src="https://code.getmdl.io/1.2.0/material.min.js"></script>
<style>
section.section--center {
max-width: 860px;
}
.mdl-card__supporting-text + .mdl-card__actions {
border-top: 1px solid rgba(0, 0, 0, 0.12);
}
main > .mdl-layout__tab-panel {
padding: 8px;
padding-top: 48px;
}
.mdl-card__actions {
margin: 0;
padding: 4px 40px;
color: inherit;
}
.mdl-card > * {
height: auto;
}
.mdl-card__actions a {
color: #00BCD4;
margin: 0;
}
.error-icon {
color: #bb7777;
vertical-align: bottom;
}
.warning-icon {
vertical-align: bottom;
}
.mdl-layout__content section:not(:last-of-type) {
position: relative;
margin-bottom: 48px;
}
.mdl-card .mdl-card__supporting-text {
margin: 40px;
-webkit-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
padding: 0;
color: inherit;
width: calc(100% - 80px);
}
div.mdl-layout__drawer-button .material-icons {
line-height: 48px;
}
.mdl-card .mdl-card__supporting-text {
margin-top: 0px;
}
.chips {
float: right;
vertical-align: middle;
}
pre.errorlines {
background-color: white;
font-family: monospace;
border: 1px solid #e0e0e0;
line-height: 0.9rem;
font-size: 0.9rem; padding: 1px 0px 1px; 1px;
overflow: scroll;
}
.prefix {
color: #660e7a;
font-weight: bold;
}
.attribute {
color: #0000ff;
font-weight: bold;
}
.value {
color: #008000;
font-weight: bold;
}
.tag {
color: #000080;
font-weight: bold;
}
.comment {
color: #808080;
font-style: italic;
}
.javadoc {
color: #808080;
font-style: italic;
}
.annotation {
color: #808000;
}
.string {
color: #008000;
font-weight: bold;
}
.number {
color: #0000ff;
}
.keyword {
color: #000080;
font-weight: bold;
}
.caretline {
background-color: #fffae3;
}
.lineno {
color: #999999;
background-color: #f0f0f0;
}
.error {
display: inline-block;
position:relative;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AwCFR4T/3uLMgAAADxJREFUCNdNyLERQEAABMCjL4lQwIzcjErpguAL+C9AvgKJDbeD/PRpLdm35Hm+MU+cB+tCKaJW4L4YBy+CAiLJrFs9mgAAAABJRU5ErkJggg==) bottom repeat-x;
}
.warning {
text-decoration: none;
background-color: #f6ebbc;
}
.overview {
padding: 10pt;
width: 100%;
overflow: auto;
border-collapse:collapse;
}
.overview tr {
border-bottom: solid 1px #eeeeee;
}
.categoryColumn a {
text-decoration: none;
color: inherit;
}
.countColumn {
text-align: right;
padding-right: 20px;
width: 50px;
}
.issueColumn {
padding-left: 16px;
}
.categoryColumn {
position: relative;
left: -50px;
padding-top: 20px;
padding-bottom: 5px;
}
</style>
<script language="javascript" type="text/javascript">
<!--
function reveal(id) {
if (document.getElementById) {
document.getElementById(id).style.display = 'block';
document.getElementById(id+'Link').style.display = 'none';
}
}
function hideid(id) {
if (document.getElementById) {
document.getElementById(id).style.display = 'none';
}
}
//-->
</script>
</head>
<body class="mdl-color--grey-100 mdl-color-text--grey-700 mdl-base">
<div class="mdl-layout mdl-js-layout mdl-layout--fixed-header">
<header class="mdl-layout__header">
<div class="mdl-layout__header-row">
<span class="mdl-layout-title">Lint Report: 8 errors and 7 warnings</span>
<div class="mdl-layout-spacer"></div>
<nav class="mdl-navigation mdl-layout--large-screen-only">
Check performed at Mon Aug 12 12:58:28 IDT 2019 </nav>
</div>
</header>
<div class="mdl-layout__drawer">
<span class="mdl-layout-title">Issue Types</span>
<nav class="mdl-navigation">
<a class="mdl-navigation__link" href="#overview"><i class="material-icons">dashboard</i>Overview</a>
<a class="mdl-navigation__link" href="#InlinedApi"><i class="material-icons warning-icon">warning</i>Using inlined constants on older versions (1)</a>
<a class="mdl-navigation__link" href="#InvalidPackage"><i class="material-icons warning-icon">warning</i>Package not included in Android (2)</a>
<a class="mdl-navigation__link" href="#NewApi"><i class="material-icons error-icon">error</i>Calling new methods on older versions (8)</a>
<a class="mdl-navigation__link" href="#OldTargetApi"><i class="material-icons warning-icon">warning</i>Target SDK attribute is not targeting latest version (1)</a>
<a class="mdl-navigation__link" href="#GradleDependency"><i class="material-icons warning-icon">warning</i>Obsolete Gradle Dependency (1)</a>
<a class="mdl-navigation__link" href="#GradleDynamicVersion"><i class="material-icons warning-icon">warning</i>Gradle Dynamic Version (1)</a>
<a class="mdl-navigation__link" href="#TrulyRandom"><i class="material-icons warning-icon">warning</i>Weak RNG (1)</a>
</nav>
</div>
<main class="mdl-layout__content">
<div class="mdl-layout__tab-panel is-active">
<a name="overview"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="OverviewCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Overview</h2>
</div>
<div class="mdl-card__supporting-text">
<table class="overview">
<tr><td class="countColumn"></td><td class="categoryColumn"><a href="#Correctness">Correctness</a>
</td></tr>
<tr>
<td class="countColumn">1</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#InlinedApi">InlinedApi</a>: Using inlined constants on older versions</td></tr>
<tr>
<td class="countColumn">2</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#InvalidPackage">InvalidPackage</a>: Package not included in Android</td></tr>
<tr>
<td class="countColumn">8</td><td class="issueColumn"><i class="material-icons error-icon">error</i>
<a href="#NewApi">NewApi</a>: Calling new methods on older versions</td></tr>
<tr>
<td class="countColumn">1</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#OldTargetApi">OldTargetApi</a>: Target SDK attribute is not targeting latest version</td></tr>
<tr>
<td class="countColumn">1</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#GradleDependency">GradleDependency</a>: Obsolete Gradle Dependency</td></tr>
<tr>
<td class="countColumn">1</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#GradleDynamicVersion">GradleDynamicVersion</a>: Gradle Dynamic Version</td></tr>
<tr><td class="countColumn"></td><td class="categoryColumn"><a href="#Security">Security</a>
</td></tr>
<tr>
<td class="countColumn">1</td><td class="issueColumn"><i class="material-icons warning-icon">warning</i>
<a href="#TrulyRandom">TrulyRandom</a>: Weak RNG</td></tr>
<tr><td></td><td class="categoryColumn"><a href="#MissingIssues">Disabled Checks (31)</a>
</td></tr></table>
<br/> </div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="OverviewCardLink" onclick="hideid('OverviewCard');">
Dismiss</button> </div>
</div>
</section>
<a name="Correctness"></a>
<a name="InlinedApi"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="InlinedApiCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Using inlined constants on older versions</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:67</span>: <span class="message">Field requires API level 23 (current min is 16): <code>android.security.keystore.KeyProperties#KEY_ALGORITHM_RSA</code></span><br /><pre class="errorlines">
<span class="lineno"> 64 </span><span class="keyword">public</span> <span class="keyword">class</span> RSA {
<span class="lineno"> 65 </span> <span class="keyword">public</span> <span class="keyword">static</span> Charset CharsetUTF_8;
<span class="lineno"> 66 </span>
<span class="caretline"><span class="lineno"> 67 </span> <span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">final</span> String ALGORITHM = <span class="warning">KeyProperties.KEY_ALGORITHM_RSA</span>; </span>
<span class="lineno"> 68 </span>
<span class="lineno"> 69 </span> <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String PUBLIC_HEADER = <span class="string">"RSA PUBLIC KEY"</span>;
<span class="lineno"> 70 </span> <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> String PRIVATE_HEADER = <span class="string">"RSA PRIVATE KEY"</span>;
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationInlinedApi" style="display: none;">
This check scans through all the Android API field references in the application and flags certain constants, such as static final integers and Strings, which were introduced in later versions. These will actually be copied into the class files rather than being referenced, which means that the value is available even when running on older devices. In some cases that's fine, and in other cases it can result in a runtime crash or incorrect behavior. It depends on the context, so consider the code carefully and decide whether it's safe and can be suppressed or whether the code needs to be guarded.<br/>
<br/>
If you really want to use this API and don't need to support older devices just set the <code>minSdkVersion</code> in your <code>build.gradle</code> or <code>AndroidManifest.xml</code> files.<br/>
If your code is <b>deliberately</b> accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the <code>@TargetApi</code> annotation specifying the local minimum SDK to apply, such as <code>@TargetApi(11)</code>, such that this check considers 11 rather than your manifest file's minimum SDK as the required API level.<br/>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "InlinedApi" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">InlinedApi</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 6/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationInlinedApiLink" onclick="reveal('explanationInlinedApi');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="InlinedApiCardLink" onclick="hideid('InlinedApiCard');">
Dismiss</button> </div>
</div>
</section><a name="InvalidPackage"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="InvalidPackageCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Package not included in Android</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../../../../../../Users/amitay/.gradle/caches/modules-2/files-2.1/com.madgag.spongycastle/bcpkix-jdk15on/1.56.0.0/434734c3c66d400d5bd4383724ccb71ada61482c/bcpkix-jdk15on-1.56.0.0.jar">../../../../../../../Users/amitay/.gradle/caches/modules-2/files-2.1/com.madgag.spongycastle/bcpkix-jdk15on/1.56.0.0/434734c3c66d400d5bd4383724ccb71ada61482c/bcpkix-jdk15on-1.56.0.0.jar</a></span>: <span class="message">Invalid package reference in library; not included in Android: <code>javax.naming.directory</code>. Referenced from <code>org.spongycastle.cert.dane.fetcher.JndiDANEFetcherFactory</code>.</span><br />
<span class="location"><a href="../../../../../../../Users/amitay/.gradle/caches/modules-2/files-2.1/com.madgag.spongycastle/bcpkix-jdk15on/1.56.0.0/434734c3c66d400d5bd4383724ccb71ada61482c/bcpkix-jdk15on-1.56.0.0.jar">../../../../../../../Users/amitay/.gradle/caches/modules-2/files-2.1/com.madgag.spongycastle/bcpkix-jdk15on/1.56.0.0/434734c3c66d400d5bd4383724ccb71ada61482c/bcpkix-jdk15on-1.56.0.0.jar</a></span>: <span class="message">Invalid package reference in library; not included in Android: <code>javax.naming</code>. Referenced from <code>org.spongycastle.cert.dane.fetcher.JndiDANEFetcherFactory.1</code>.</span><br />
</div>
<div class="metadata"><div class="explanation" id="explanationInvalidPackage" style="display: none;">
This check scans through libraries looking for calls to APIs that are not included in Android.<br/>
<br/>
When you create Android projects, the classpath is set up such that you can only access classes in the API packages that are included in Android. However, if you add other projects to your libs/ folder, there is no guarantee that those .jar files were built with an Android specific classpath, and in particular, they could be accessing unsupported APIs such as java.applet.<br/>
<br/>
This check scans through library jars and looks for references to API packages that are not included in Android and flags these. This is only an error if your code calls one of the library classes which wind up referencing the unsupported package.<br/>To suppress this error, use the issue id "InvalidPackage" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">InvalidPackage</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 6/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationInvalidPackageLink" onclick="reveal('explanationInvalidPackage');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="InvalidPackageCardLink" onclick="hideid('InvalidPackageCard');">
Dismiss</button> </div>
</div>
</section><a name="NewApi"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="NewApiCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Calling new methods on older versions</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:314</span>: <span class="message">Call requires API level 18 (current min is 16): new android.security.KeyPairGeneratorSpec.Builder</span><br /><pre class="errorlines">
<span class="lineno"> 311 </span> } <span class="keyword">else</span> {
<span class="lineno"> 312 </span> Calendar endDate = Calendar.getInstance();
<span class="lineno"> 313 </span> endDate.add(Calendar.YEAR, <span class="number">1</span>);
<span class="caretline"><span class="lineno"> 314 </span> KeyPairGeneratorSpec.Builder keyPairGeneratorSpec = <span class="error"><span class="keyword">new</span> KeyPairGeneratorSpec.Builder</span>(context)</span>
<span class="lineno"> 315 </span> .setAlias(keyTag)
<span class="lineno"> 316 </span> .setSubject(<span class="keyword">new</span> X500Principal(
<span class="lineno"> 317 </span> String.format(<span class="string">"CN=%s, OU=%s"</span>, keyTag, context.getPackageName())
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:315</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#setAlias</span><br /><pre class="errorlines">
<span class="lineno"> 312 </span> Calendar endDate = Calendar.getInstance();
<span class="lineno"> 313 </span> endDate.add(Calendar.YEAR, <span class="number">1</span>);
<span class="lineno"> 314 </span> KeyPairGeneratorSpec.Builder keyPairGeneratorSpec = <span class="keyword">new</span> KeyPairGeneratorSpec.Builder(context)
<span class="caretline"><span class="lineno"> 315 </span> .<span class="error">setAlias</span>(keyTag) </span>
<span class="lineno"> 316 </span> .setSubject(<span class="keyword">new</span> X500Principal(
<span class="lineno"> 317 </span> String.format(<span class="string">"CN=%s, OU=%s"</span>, keyTag, context.getPackageName())
<span class="lineno"> 318 </span> ))
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:316</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#setSubject</span><br /><pre class="errorlines">
<span class="lineno"> 313 </span> endDate.add(Calendar.YEAR, <span class="number">1</span>);
<span class="lineno"> 314 </span> KeyPairGeneratorSpec.Builder keyPairGeneratorSpec = <span class="keyword">new</span> KeyPairGeneratorSpec.Builder(context)
<span class="lineno"> 315 </span> .setAlias(keyTag)
<span class="caretline"><span class="lineno"> 316 </span> .<span class="error">setSubject</span>(<span class="keyword">new</span> X500Principal( </span>
<span class="lineno"> 317 </span> String.format(<span class="string">"CN=%s, OU=%s"</span>, keyTag, context.getPackageName())
<span class="lineno"> 318 </span> ))
<span class="lineno"> 319 </span> .setSerialNumber(BigInteger.ONE)
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:319</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#setSerialNumber</span><br /><pre class="errorlines">
<span class="lineno"> 316 </span> .setSubject(<span class="keyword">new</span> X500Principal(
<span class="lineno"> 317 </span> String.format(<span class="string">"CN=%s, OU=%s"</span>, keyTag, context.getPackageName())
<span class="lineno"> 318 </span> ))
<span class="caretline"><span class="lineno"> 319 </span> .<span class="error">setSerialNumber</span>(BigInteger.ONE) </span>
<span class="lineno"> 320 </span> .setStartDate(Calendar.getInstance().getTime())
<span class="lineno"> 321 </span> .setEndDate(endDate.getTime());
<span class="lineno"> 322 </span> <span class="keyword">if</span> (android.os.Build.VERSION.SDK_INT >= <span class="number">19</span>) {
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:320</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#setStartDate</span><br /><pre class="errorlines">
<span class="lineno"> 317 </span> String.format(<span class="string">"CN=%s, OU=%s"</span>, keyTag, context.getPackageName())
<span class="lineno"> 318 </span> ))
<span class="lineno"> 319 </span> .setSerialNumber(BigInteger.ONE)
<span class="caretline"><span class="lineno"> 320 </span> .<span class="error">setStartDate</span>(Calendar.getInstance().getTime()) </span>
<span class="lineno"> 321 </span> .setEndDate(endDate.getTime());
<span class="lineno"> 322 </span> <span class="keyword">if</span> (android.os.Build.VERSION.SDK_INT >= <span class="number">19</span>) {
<span class="lineno"> 323 </span> keyPairGeneratorSpec.setKeySize(keySize).setKeyType(ALGORITHM);
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:321</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#setEndDate</span><br /><pre class="errorlines">
<span class="lineno"> 318 </span> ))
<span class="lineno"> 319 </span> .setSerialNumber(BigInteger.ONE)
<span class="lineno"> 320 </span> .setStartDate(Calendar.getInstance().getTime())
<span class="caretline"><span class="lineno"> 321 </span> .<span class="error">setEndDate</span>(endDate.getTime()); </span>
<span class="lineno"> 322 </span> <span class="keyword">if</span> (android.os.Build.VERSION.SDK_INT >= <span class="number">19</span>) {
<span class="lineno"> 323 </span> keyPairGeneratorSpec.setKeySize(keySize).setKeyType(ALGORITHM);
<span class="lineno"> 324 </span> }
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:325</span>: <span class="message">Call requires API level 18 (current min is 16): android.security.KeyPairGeneratorSpec.Builder#build</span><br /><pre class="errorlines">
<span class="lineno"> 322 </span> <span class="keyword">if</span> (android.os.Build.VERSION.SDK_INT >= <span class="number">19</span>) {
<span class="lineno"> 323 </span> keyPairGeneratorSpec.setKeySize(keySize).setKeyType(ALGORITHM);
<span class="lineno"> 324 </span> }
<span class="caretline"><span class="lineno"> 325 </span> kpg.initialize(keyPairGeneratorSpec.<span class="error">build</span>()); </span>
<span class="lineno"> 326 </span> }
<span class="lineno"> 327 </span>
<span class="lineno"> 328 </span> KeyPair keyPair = kpg.genKeyPair();
</pre>
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:325</span>: <span class="message">Cast from <code>KeyPairGeneratorSpec</code> to <code>AlgorithmParameterSpec</code> requires API level 18 (current min is 16)</span><br /><pre class="errorlines">
<span class="lineno"> 322 </span> <span class="keyword">if</span> (android.os.Build.VERSION.SDK_INT >= <span class="number">19</span>) {
<span class="lineno"> 323 </span> keyPairGeneratorSpec.setKeySize(keySize).setKeyType(ALGORITHM);
<span class="lineno"> 324 </span> }
<span class="caretline"><span class="lineno"> 325 </span> kpg.initialize(<span class="error">keyPairGeneratorSpec.build()</span>); </span>
<span class="lineno"> 326 </span> }
<span class="lineno"> 327 </span>
<span class="lineno"> 328 </span> KeyPair keyPair = kpg.genKeyPair();
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationNewApi" style="display: none;">
This check scans through all the Android API calls in the application and warns about any calls that are not available on <b>all</b> versions targeted by this application (according to its minimum SDK attribute in the manifest).<br/>
<br/>
If you really want to use this API and don't need to support older devices just set the <code>minSdkVersion</code> in your <code>build.gradle</code> or <code>AndroidManifest.xml</code> files.<br/>
<br/>
If your code is <b>deliberately</b> accessing newer APIs, and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate your class or method with the <code>@TargetApi</code> annotation specifying the local minimum SDK to apply, such as <code>@TargetApi(11)</code>, such that this check considers 11 rather than your manifest file's minimum SDK as the required API level.<br/>
<br/>
If you are deliberately setting <code>android:</code> attributes in style definitions, make sure you place this in a <code>values-v</code><i>NN</i> folder in order to avoid running into runtime conflicts on certain devices where manufacturers have added custom attributes whose ids conflict with the new ones on later platforms.<br/>
<br/>
Similarly, you can use tools:targetApi="11" in an XML file to indicate that the element will only be inflated in an adequate context.<br/>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "NewApi" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">NewApi</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Error</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 6/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationNewApiLink" onclick="reveal('explanationNewApi');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="NewApiCardLink" onclick="hideid('NewApiCard');">
Dismiss</button> </div>
</div>
</section><a name="OldTargetApi"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="OldTargetApiCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Target SDK attribute is not targeting latest version</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../build.gradle">../../build.gradle</a>:28</span>: <span class="message">Not targeting the latest versions of Android; compatibility modes apply. Consider testing and updating this version. Consult the android.os.Build.VERSION_CODES javadoc for details.</span><br /><pre class="errorlines">
<span class="lineno"> 25 </span>
<span class="lineno"> 26 </span> defaultConfig {
<span class="lineno"> 27 </span> minSdkVersion <span class="number">16</span>
<span class="caretline"><span class="lineno"> 28 </span> <span class="warning">targetSdkVersion <span class="number">26</span></span>
</span>
<span class="lineno"> 29 </span> versionCode <span class="number">1</span>
<span class="lineno"> 30 </span> versionName <span class="string">"1.0"</span>
<span class="lineno"> 31 </span> ndk {
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationOldTargetApi" style="display: none;">
When your application runs on a version of Android that is more recent than your <code>targetSdkVersion</code> specifies that it has been tested with, various compatibility modes kick in. This ensures that your application continues to work, but it may look out of place. For example, if the <code>targetSdkVersion</code> is less than 14, your app may get an option button in the UI.<br/>
<br/>
To fix this issue, set the <code>targetSdkVersion</code> to the highest available value. Then test your app to make sure everything works correctly. You may want to consult the compatibility notes to see what changes apply to each version you are adding support for: <a href="http://developer.android.com/reference/android/os/Build.VERSION_CODES.html">http://developer.android.com/reference/android/os/Build.VERSION_CODES.html</a> as well as follow this guide:<br/>
<a href="https://developer.android.com/distribute/best-practices/develop/target-sdk.html">https://developer.android.com/distribute/best-practices/develop/target-sdk.html</a><br/><div class="moreinfo">More info: <ul><li><a href="https://developer.android.com/distribute/best-practices/develop/target-sdk.html">https://developer.android.com/distribute/best-practices/develop/target-sdk.html</a>
<li><a href="http://developer.android.com/reference/android/os/Build.VERSION_CODES.html">http://developer.android.com/reference/android/os/Build.VERSION_CODES.html</a>
</ul></div>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "OldTargetApi" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">OldTargetApi</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 6/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationOldTargetApiLink" onclick="reveal('explanationOldTargetApi');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="OldTargetApiCardLink" onclick="hideid('OldTargetApiCard');">
Dismiss</button> </div>
</div>
</section><a name="GradleDependency"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="GradleDependencyCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Obsolete Gradle Dependency</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../build.gradle">../../build.gradle</a>:17</span>: <span class="message">A newer version of com.android.tools.build:gradle than 3.3.2 is available: 3.4.2</span><br /><pre class="errorlines">
<span class="lineno"> 14 </span> }
<span class="lineno"> 15 </span>
<span class="lineno"> 16 </span> dependencies {
<span class="caretline"><span class="lineno"> 17 </span> <span class="warning">classpath <span class="string">'com.android.tools.build:gradle:3.3.2'</span></span>
</span>
<span class="lineno"> 18 </span> }
<span class="lineno"> 19 </span>}
<span class="lineno"> 20 </span>apply plugin: <span class="string">'com.android.library'</span>
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationGradleDependency" style="display: none;">
This detector looks for usages of libraries where the version you are using is not the current stable release. Using older versions is fine, and there are cases where you deliberately want to stick with an older version. However, you may simply not be aware that a more recent version is available, and that is what this lint check helps find.<br/>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "GradleDependency" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">GradleDependency</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 4/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationGradleDependencyLink" onclick="reveal('explanationGradleDependency');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="GradleDependencyCardLink" onclick="hideid('GradleDependencyCard');">
Dismiss</button> </div>
</div>
</section><a name="GradleDynamicVersion"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="GradleDynamicVersionCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Gradle Dynamic Version</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../build.gradle">../../build.gradle</a>:58</span>: <span class="message">Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.facebook.react:react-native:+)</span><br /><pre class="errorlines">
<span class="lineno"> 55 </span>}
<span class="lineno"> 56 </span>
<span class="lineno"> 57 </span>dependencies {
<span class="caretline"><span class="lineno"> 58 </span> <span class="warning">implementation <span class="string">'com.facebook.react:react-native:+'</span></span>
</span>
<span class="lineno"> 59 </span> implementation <span class="string">'com.madgag.spongycastle:core:1.56.0.0'</span>
<span class="lineno"> 60 </span> implementation <span class="string">'com.madgag.spongycastle:prov:1.56.0.0'</span>
<span class="lineno"> 61 </span> implementation <span class="string">'com.madgag.spongycastle:bcpkix-jdk15on:1.56.0.0'</span>
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationGradleDynamicVersion" style="display: none;">
Using <code>+</code> in dependencies lets you automatically pick up the latest available version rather than a specific, named version. However, this is not recommended; your builds are not repeatable; you may have tested with a slightly different version than what the build server used. (Using a dynamic version as the major version number is more problematic than using it in the minor version position.)<br/>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "GradleDynamicVersion" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">GradleDynamicVersion</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Correctness</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 4/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationGradleDynamicVersionLink" onclick="reveal('explanationGradleDynamicVersion');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="GradleDynamicVersionCardLink" onclick="hideid('GradleDynamicVersionCard');">
Dismiss</button> </div>
</div>
</section>
<a name="Security"></a>
<a name="TrulyRandom"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="TrulyRandomCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Weak RNG</h2>
</div>
<div class="mdl-card__supporting-text">
<div class="issue">
<div class="warningslist">
<span class="location"><a href="../../src/main/java/com/RNRSA/RSA.java">../../src/main/java/com/RNRSA/RSA.java</a>:284</span>: <span class="message">Potentially insecure random numbers on Android 4.3 and older. Read <a href="https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html">https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html</a> for more info.</span><br /><pre class="errorlines">
<span class="lineno"> 281 </span> }
<span class="lineno"> 282 </span>
<span class="lineno"> 283 </span> <span class="keyword">public</span> <span class="keyword">void</span> generate(<span class="keyword">int</span> keySize) <span class="keyword">throws</span> IOException, NoSuchAlgorithmException, InvalidAlgorithmParameterException {
<span class="caretline"><span class="lineno"> 284 </span> KeyPairGenerator kpg = KeyPairGenerator.<span class="warning">getInstance</span>(ALGORITHM); </span>
<span class="lineno"> 285 </span> kpg.initialize(keySize);
<span class="lineno"> 286 </span>
<span class="lineno"> 287 </span> KeyPair keyPair = kpg.genKeyPair();
</pre>
</div>
<div class="metadata"><div class="explanation" id="explanationTrulyRandom" style="display: none;">
Key generation, signing, encryption, and random number generation may not receive cryptographically strong values due to improper initialization of the underlying PRNG on Android 4.3 and below.<br/>
<br/>
If your application relies on cryptographically secure random number generation you should apply the workaround described in <a href="https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html">https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html</a> .<br/>
<br/>
This lint rule is mostly informational; it does not accurately detect whether cryptographically secure RNG is required, or whether the workaround has already been applied. After reading the blog entry and updating your code if necessary, you can disable this lint issue.<br/><div class="moreinfo">More info: <a href="https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html">https://android-developers.blogspot.com/2013/08/some-securerandom-thoughts.html</a>
</div>To suppress this error, use the issue id "TrulyRandom" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="chips">
<span class="mdl-chip">
<span class="mdl-chip__text">TrulyRandom</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Security</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Warning</span>
</span>
<span class="mdl-chip">
<span class="mdl-chip__text">Priority 9/10</span>
</span>
</div>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="explanationTrulyRandomLink" onclick="reveal('explanationTrulyRandom');">
Explain</button><button class="mdl-button mdl-js-button mdl-js-ripple-effect" id="TrulyRandomCardLink" onclick="hideid('TrulyRandomCard');">
Dismiss</button> </div>
</div>
</section>
<a name="MissingIssues"></a>
<section class="section--center mdl-grid mdl-grid--no-spacing mdl-shadow--2dp" id="MissingIssuesCard" style="display: block;">
<div class="mdl-card mdl-cell mdl-cell--12-col">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">Disabled Checks</h2>
</div>
<div class="mdl-card__supporting-text">
One or more issues were not run by lint, either
because the check is not enabled by default, or because
it was disabled with a command line flag or via one or
more <code>lint.xml</code> configuration files in the project directories.
<div id="SuppressedIssues" style="display: none;"><br/><br/><div class="issue">
<div class="id">AppLinksAutoVerifyError<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
Ensures that app links are correctly set and associated with website.<br/><div class="moreinfo">More info: <a href="https://g.co/appindexing/applinks">https://g.co/appindexing/applinks</a>
</div>To suppress this error, use the issue id "AppLinksAutoVerifyError" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">AppLinksAutoVerifyWarning<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
Ensures that app links are correctly set and associated with website.<br/><div class="moreinfo">More info: <a href="https://g.co/appindexing/applinks">https://g.co/appindexing/applinks</a>
</div>To suppress this error, use the issue id "AppLinksAutoVerifyWarning" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">BackButton<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
According to the Android Design Guide,<br/>
<br/>
"Other platforms use an explicit back button with label to allow the user to navigate up the application's hierarchy. Instead, Android uses the main action bar's app icon for hierarchical navigation and the navigation bar's back button for temporal navigation."<br/>
This check is not very sophisticated (it just looks for buttons with the label "Back"), so it is disabled by default to not trigger on common scenarios like pairs of Back/Next buttons to paginate through screens.<br/><div class="moreinfo">More info: <a href="http://developer.android.com/design/patterns/pure-android.html">http://developer.android.com/design/patterns/pure-android.html</a>
</div>To suppress this error, use the issue id "BackButton" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">ConvertToWebp<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
The WebP format is typically more compact than PNG and JPEG. As of Android 4.2.1 it supports transparency and lossless conversion as well. Note that there is a quickfix in the IDE which lets you perform conversion.<br/>
<br/>
Launcher icons must be in the PNG format.<br/>Note: This issue has an associated quickfix operation in Android Studio and IntelliJ IDEA.<br>
To suppress this error, use the issue id "ConvertToWebp" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">DalvikOverride<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
The Dalvik virtual machine will treat a package private method in one class as overriding a package private method in its super class, even if they are in separate packages.<br/>
<br/>
If you really did intend for this method to override the other, make the method <code>protected</code> instead.<br/>
<br/>
If you did <b>not</b> intend the override, consider making the method private, or changing its name or signature.<br/>
<br/>
Note that this check is disabled be default, because ART (the successor to Dalvik) no longer has this behavior.<br/>To suppress this error, use the issue id "DalvikOverride" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">DuplicateStrings<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
Duplicate strings can make applications larger unnecessarily.<br/>
<br/>
This lint check looks for duplicate strings, including differences for strings where the only difference is in capitalization. Title casing and all uppercase can all be adjusted in the layout or in code.<br/><div class="moreinfo">More info: <a href="https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType">https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType</a>
</div>To suppress this error, use the issue id "DuplicateStrings" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">EasterEgg<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
An "easter egg" is code deliberately hidden in the code, both from potential users and even from other developers. This lint check looks for code which looks like it may be hidden from sight.<br/>To suppress this error, use the issue id "EasterEgg" as explained in the <a href="#SuppressInfo">Suppressing Warnings and Errors</a> section.<br/>
<br/></div>
</div>
</div>
<div class="issue">
<div class="id">FieldGetter<div class="issueSeparator"></div>
</div>
<div class="metadata">Disabled By: Default<br/>
<div class="explanation">
Accessing a field within the class that defines a getter for that field is at least 3 times faster than calling the getter. For simple getters that do nothing other than return the field, you might want to just reference the local field directly instead.<br/>
<br/>
<b>NOTE</b>: As of Android 2.3 (Gingerbread), this optimization is performed automatically by Dalvik, so there is no need to change your code; this is only relevant if you are targeting older versions of Android.<br/><div class="moreinfo">More info: <a href="http://developer.android.com/guide/practices/design/performance.html#internal_get_set">http://develope