1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.security; 27 28 import android.compat.annotation.UnsupportedAppUsage; 29 30 @SuppressWarnings({"unchecked", "deprecation", "all"}) 31 public class KeyStore { 32 KeyStore( java.security.KeyStoreSpi keyStoreSpi, java.security.Provider provider, java.lang.String type)33 protected KeyStore( 34 java.security.KeyStoreSpi keyStoreSpi, 35 java.security.Provider provider, 36 java.lang.String type) { 37 throw new RuntimeException("Stub!"); 38 } 39 getInstance(java.lang.String type)40 public static java.security.KeyStore getInstance(java.lang.String type) 41 throws java.security.KeyStoreException { 42 throw new RuntimeException("Stub!"); 43 } 44 getInstance( java.lang.String type, java.lang.String provider)45 public static java.security.KeyStore getInstance( 46 java.lang.String type, java.lang.String provider) 47 throws java.security.KeyStoreException, java.security.NoSuchProviderException { 48 throw new RuntimeException("Stub!"); 49 } 50 getInstance( java.lang.String type, java.security.Provider provider)51 public static java.security.KeyStore getInstance( 52 java.lang.String type, java.security.Provider provider) 53 throws java.security.KeyStoreException { 54 throw new RuntimeException("Stub!"); 55 } 56 getDefaultType()57 public static final java.lang.String getDefaultType() { 58 throw new RuntimeException("Stub!"); 59 } 60 getProvider()61 public final java.security.Provider getProvider() { 62 throw new RuntimeException("Stub!"); 63 } 64 getType()65 public final java.lang.String getType() { 66 throw new RuntimeException("Stub!"); 67 } 68 getKey(java.lang.String alias, char[] password)69 public final java.security.Key getKey(java.lang.String alias, char[] password) 70 throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, 71 java.security.UnrecoverableKeyException { 72 throw new RuntimeException("Stub!"); 73 } 74 getCertificateChain(java.lang.String alias)75 public final java.security.cert.Certificate[] getCertificateChain(java.lang.String alias) 76 throws java.security.KeyStoreException { 77 throw new RuntimeException("Stub!"); 78 } 79 getCertificate(java.lang.String alias)80 public final java.security.cert.Certificate getCertificate(java.lang.String alias) 81 throws java.security.KeyStoreException { 82 throw new RuntimeException("Stub!"); 83 } 84 getCreationDate(java.lang.String alias)85 public final java.util.Date getCreationDate(java.lang.String alias) 86 throws java.security.KeyStoreException { 87 throw new RuntimeException("Stub!"); 88 } 89 setKeyEntry( java.lang.String alias, java.security.Key key, char[] password, java.security.cert.Certificate[] chain)90 public final void setKeyEntry( 91 java.lang.String alias, 92 java.security.Key key, 93 char[] password, 94 java.security.cert.Certificate[] chain) 95 throws java.security.KeyStoreException { 96 throw new RuntimeException("Stub!"); 97 } 98 setKeyEntry( java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain)99 public final void setKeyEntry( 100 java.lang.String alias, byte[] key, java.security.cert.Certificate[] chain) 101 throws java.security.KeyStoreException { 102 throw new RuntimeException("Stub!"); 103 } 104 setCertificateEntry( java.lang.String alias, java.security.cert.Certificate cert)105 public final void setCertificateEntry( 106 java.lang.String alias, java.security.cert.Certificate cert) 107 throws java.security.KeyStoreException { 108 throw new RuntimeException("Stub!"); 109 } 110 deleteEntry(java.lang.String alias)111 public final void deleteEntry(java.lang.String alias) throws java.security.KeyStoreException { 112 throw new RuntimeException("Stub!"); 113 } 114 aliases()115 public final java.util.Enumeration<java.lang.String> aliases() 116 throws java.security.KeyStoreException { 117 throw new RuntimeException("Stub!"); 118 } 119 containsAlias(java.lang.String alias)120 public final boolean containsAlias(java.lang.String alias) 121 throws java.security.KeyStoreException { 122 throw new RuntimeException("Stub!"); 123 } 124 size()125 public final int size() throws java.security.KeyStoreException { 126 throw new RuntimeException("Stub!"); 127 } 128 isKeyEntry(java.lang.String alias)129 public final boolean isKeyEntry(java.lang.String alias) throws java.security.KeyStoreException { 130 throw new RuntimeException("Stub!"); 131 } 132 isCertificateEntry(java.lang.String alias)133 public final boolean isCertificateEntry(java.lang.String alias) 134 throws java.security.KeyStoreException { 135 throw new RuntimeException("Stub!"); 136 } 137 getCertificateAlias(java.security.cert.Certificate cert)138 public final java.lang.String getCertificateAlias(java.security.cert.Certificate cert) 139 throws java.security.KeyStoreException { 140 throw new RuntimeException("Stub!"); 141 } 142 store(java.io.OutputStream stream, char[] password)143 public final void store(java.io.OutputStream stream, char[] password) 144 throws java.security.cert.CertificateException, java.io.IOException, 145 java.security.KeyStoreException, java.security.NoSuchAlgorithmException { 146 throw new RuntimeException("Stub!"); 147 } 148 store(java.security.KeyStore.LoadStoreParameter param)149 public final void store(java.security.KeyStore.LoadStoreParameter param) 150 throws java.security.cert.CertificateException, java.io.IOException, 151 java.security.KeyStoreException, java.security.NoSuchAlgorithmException { 152 throw new RuntimeException("Stub!"); 153 } 154 load(java.io.InputStream stream, char[] password)155 public final void load(java.io.InputStream stream, char[] password) 156 throws java.security.cert.CertificateException, java.io.IOException, 157 java.security.NoSuchAlgorithmException { 158 throw new RuntimeException("Stub!"); 159 } 160 load(java.security.KeyStore.LoadStoreParameter param)161 public final void load(java.security.KeyStore.LoadStoreParameter param) 162 throws java.security.cert.CertificateException, java.io.IOException, 163 java.security.NoSuchAlgorithmException { 164 throw new RuntimeException("Stub!"); 165 } 166 getEntry( java.lang.String alias, java.security.KeyStore.ProtectionParameter protParam)167 public final java.security.KeyStore.Entry getEntry( 168 java.lang.String alias, java.security.KeyStore.ProtectionParameter protParam) 169 throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, 170 java.security.UnrecoverableEntryException { 171 throw new RuntimeException("Stub!"); 172 } 173 setEntry( java.lang.String alias, java.security.KeyStore.Entry entry, java.security.KeyStore.ProtectionParameter protParam)174 public final void setEntry( 175 java.lang.String alias, 176 java.security.KeyStore.Entry entry, 177 java.security.KeyStore.ProtectionParameter protParam) 178 throws java.security.KeyStoreException { 179 throw new RuntimeException("Stub!"); 180 } 181 entryInstanceOf( java.lang.String alias, java.lang.Class<? extends java.security.KeyStore.Entry> entryClass)182 public final boolean entryInstanceOf( 183 java.lang.String alias, 184 java.lang.Class<? extends java.security.KeyStore.Entry> entryClass) 185 throws java.security.KeyStoreException { 186 throw new RuntimeException("Stub!"); 187 } 188 189 private static final java.lang.String KEYSTORE_TYPE = "keystore.type"; 190 191 private boolean initialized = false; 192 193 @UnsupportedAppUsage 194 private java.security.KeyStoreSpi keyStoreSpi; 195 196 private java.security.Provider provider; 197 198 private java.lang.String type; 199 200 @SuppressWarnings({"unchecked", "deprecation", "all"}) 201 public abstract static class Builder { 202 Builder()203 protected Builder() { 204 throw new RuntimeException("Stub!"); 205 } 206 getKeyStore()207 public abstract java.security.KeyStore getKeyStore() throws java.security.KeyStoreException; 208 getProtectionParameter( java.lang.String alias)209 public abstract java.security.KeyStore.ProtectionParameter getProtectionParameter( 210 java.lang.String alias) throws java.security.KeyStoreException; 211 newInstance( java.security.KeyStore keyStore, java.security.KeyStore.ProtectionParameter protectionParameter)212 public static java.security.KeyStore.Builder newInstance( 213 java.security.KeyStore keyStore, 214 java.security.KeyStore.ProtectionParameter protectionParameter) { 215 throw new RuntimeException("Stub!"); 216 } 217 newInstance( java.lang.String type, java.security.Provider provider, java.io.File file, java.security.KeyStore.ProtectionParameter protection)218 public static java.security.KeyStore.Builder newInstance( 219 java.lang.String type, 220 java.security.Provider provider, 221 java.io.File file, 222 java.security.KeyStore.ProtectionParameter protection) { 223 throw new RuntimeException("Stub!"); 224 } 225 newInstance( java.lang.String type, java.security.Provider provider, java.security.KeyStore.ProtectionParameter protection)226 public static java.security.KeyStore.Builder newInstance( 227 java.lang.String type, 228 java.security.Provider provider, 229 java.security.KeyStore.ProtectionParameter protection) { 230 throw new RuntimeException("Stub!"); 231 } 232 233 static final int MAX_CALLBACK_TRIES = 3; // 0x3 234 235 @SuppressWarnings({"unchecked", "deprecation", "all"}) 236 private static final class FileBuilder extends java.security.KeyStore.Builder { 237 FileBuilder( java.lang.String type, java.security.Provider provider, java.io.File file, java.security.KeyStore.ProtectionParameter protection, java.security.AccessControlContext context)238 FileBuilder( 239 java.lang.String type, 240 java.security.Provider provider, 241 java.io.File file, 242 java.security.KeyStore.ProtectionParameter protection, 243 java.security.AccessControlContext context) { 244 throw new RuntimeException("Stub!"); 245 } 246 getKeyStore()247 public synchronized java.security.KeyStore getKeyStore() 248 throws java.security.KeyStoreException { 249 throw new RuntimeException("Stub!"); 250 } 251 getProtectionParameter( java.lang.String alias)252 public synchronized java.security.KeyStore.ProtectionParameter getProtectionParameter( 253 java.lang.String alias) { 254 throw new RuntimeException("Stub!"); 255 } 256 257 private final java.security.AccessControlContext context; 258 259 { 260 context = null; 261 } 262 263 private final java.io.File file; 264 265 { 266 file = null; 267 } 268 269 private java.security.KeyStore.ProtectionParameter keyProtection; 270 271 private java.security.KeyStore keyStore; 272 273 private java.lang.Throwable oldException; 274 275 private java.security.KeyStore.ProtectionParameter protection; 276 277 private final java.security.Provider provider; 278 279 { 280 provider = null; 281 } 282 283 private final java.lang.String type; 284 285 { 286 type = null; 287 } 288 } 289 } 290 291 @SuppressWarnings({"unchecked", "deprecation", "all"}) 292 public static class CallbackHandlerProtection 293 implements java.security.KeyStore.ProtectionParameter { 294 CallbackHandlerProtection(javax.security.auth.callback.CallbackHandler handler)295 public CallbackHandlerProtection(javax.security.auth.callback.CallbackHandler handler) { 296 throw new RuntimeException("Stub!"); 297 } 298 getCallbackHandler()299 public javax.security.auth.callback.CallbackHandler getCallbackHandler() { 300 throw new RuntimeException("Stub!"); 301 } 302 303 private final javax.security.auth.callback.CallbackHandler handler; 304 305 { 306 handler = null; 307 } 308 } 309 310 @SuppressWarnings({"unchecked", "deprecation", "all"}) 311 public static interface Entry { 312 getAttributes()313 public default java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes() { 314 throw new RuntimeException("Stub!"); 315 } 316 317 @SuppressWarnings({"unchecked", "deprecation", "all"}) 318 public static interface Attribute { 319 getName()320 public java.lang.String getName(); 321 getValue()322 public java.lang.String getValue(); 323 } 324 } 325 326 @SuppressWarnings({"unchecked", "deprecation", "all"}) 327 public static interface LoadStoreParameter { 328 getProtectionParameter()329 public java.security.KeyStore.ProtectionParameter getProtectionParameter(); 330 } 331 332 @SuppressWarnings({"unchecked", "deprecation", "all"}) 333 public static class PasswordProtection 334 implements java.security.KeyStore.ProtectionParameter, javax.security.auth.Destroyable { 335 PasswordProtection(char[] password)336 public PasswordProtection(char[] password) { 337 throw new RuntimeException("Stub!"); 338 } 339 PasswordProtection( char[] password, java.lang.String protectionAlgorithm, java.security.spec.AlgorithmParameterSpec protectionParameters)340 public PasswordProtection( 341 char[] password, 342 java.lang.String protectionAlgorithm, 343 java.security.spec.AlgorithmParameterSpec protectionParameters) { 344 throw new RuntimeException("Stub!"); 345 } 346 getProtectionAlgorithm()347 public java.lang.String getProtectionAlgorithm() { 348 throw new RuntimeException("Stub!"); 349 } 350 getProtectionParameters()351 public java.security.spec.AlgorithmParameterSpec getProtectionParameters() { 352 throw new RuntimeException("Stub!"); 353 } 354 getPassword()355 public synchronized char[] getPassword() { 356 throw new RuntimeException("Stub!"); 357 } 358 destroy()359 public synchronized void destroy() throws javax.security.auth.DestroyFailedException { 360 throw new RuntimeException("Stub!"); 361 } 362 isDestroyed()363 public synchronized boolean isDestroyed() { 364 throw new RuntimeException("Stub!"); 365 } 366 367 private volatile boolean destroyed = false; 368 369 private final char[] password; 370 371 { 372 password = new char[0]; 373 } 374 375 private final java.lang.String protectionAlgorithm; 376 377 { 378 protectionAlgorithm = null; 379 } 380 381 private final java.security.spec.AlgorithmParameterSpec protectionParameters; 382 383 { 384 protectionParameters = null; 385 } 386 } 387 388 @SuppressWarnings({"unchecked", "deprecation", "all"}) 389 public static final class PrivateKeyEntry implements java.security.KeyStore.Entry { 390 PrivateKeyEntry( java.security.PrivateKey privateKey, java.security.cert.Certificate[] chain)391 public PrivateKeyEntry( 392 java.security.PrivateKey privateKey, java.security.cert.Certificate[] chain) { 393 throw new RuntimeException("Stub!"); 394 } 395 PrivateKeyEntry( java.security.PrivateKey privateKey, java.security.cert.Certificate[] chain, java.util.Set<java.security.KeyStore.Entry.Attribute> attributes)396 public PrivateKeyEntry( 397 java.security.PrivateKey privateKey, 398 java.security.cert.Certificate[] chain, 399 java.util.Set<java.security.KeyStore.Entry.Attribute> attributes) { 400 throw new RuntimeException("Stub!"); 401 } 402 getPrivateKey()403 public java.security.PrivateKey getPrivateKey() { 404 throw new RuntimeException("Stub!"); 405 } 406 getCertificateChain()407 public java.security.cert.Certificate[] getCertificateChain() { 408 throw new RuntimeException("Stub!"); 409 } 410 getCertificate()411 public java.security.cert.Certificate getCertificate() { 412 throw new RuntimeException("Stub!"); 413 } 414 getAttributes()415 public java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes() { 416 throw new RuntimeException("Stub!"); 417 } 418 toString()419 public java.lang.String toString() { 420 throw new RuntimeException("Stub!"); 421 } 422 423 private final java.util.Set<java.security.KeyStore.Entry.Attribute> attributes; 424 425 { 426 attributes = null; 427 } 428 429 private final java.security.cert.Certificate[] chain; 430 431 { 432 chain = new java.security.cert.Certificate[0]; 433 } 434 435 private final java.security.PrivateKey privKey; 436 437 { 438 privKey = null; 439 } 440 } 441 442 @SuppressWarnings({"unchecked", "deprecation", "all"}) 443 public static interface ProtectionParameter {} 444 445 @SuppressWarnings({"unchecked", "deprecation", "all"}) 446 public static final class SecretKeyEntry implements java.security.KeyStore.Entry { 447 SecretKeyEntry(javax.crypto.SecretKey secretKey)448 public SecretKeyEntry(javax.crypto.SecretKey secretKey) { 449 throw new RuntimeException("Stub!"); 450 } 451 SecretKeyEntry( javax.crypto.SecretKey secretKey, java.util.Set<java.security.KeyStore.Entry.Attribute> attributes)452 public SecretKeyEntry( 453 javax.crypto.SecretKey secretKey, 454 java.util.Set<java.security.KeyStore.Entry.Attribute> attributes) { 455 throw new RuntimeException("Stub!"); 456 } 457 getSecretKey()458 public javax.crypto.SecretKey getSecretKey() { 459 throw new RuntimeException("Stub!"); 460 } 461 getAttributes()462 public java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes() { 463 throw new RuntimeException("Stub!"); 464 } 465 toString()466 public java.lang.String toString() { 467 throw new RuntimeException("Stub!"); 468 } 469 470 private final java.util.Set<java.security.KeyStore.Entry.Attribute> attributes; 471 472 { 473 attributes = null; 474 } 475 476 private final javax.crypto.SecretKey sKey; 477 478 { 479 sKey = null; 480 } 481 } 482 483 @SuppressWarnings({"unchecked", "deprecation", "all"}) 484 static class SimpleLoadStoreParameter implements java.security.KeyStore.LoadStoreParameter { 485 SimpleLoadStoreParameter(java.security.KeyStore.ProtectionParameter protection)486 SimpleLoadStoreParameter(java.security.KeyStore.ProtectionParameter protection) { 487 throw new RuntimeException("Stub!"); 488 } 489 getProtectionParameter()490 public java.security.KeyStore.ProtectionParameter getProtectionParameter() { 491 throw new RuntimeException("Stub!"); 492 } 493 494 private final java.security.KeyStore.ProtectionParameter protection; 495 496 { 497 protection = null; 498 } 499 } 500 501 @SuppressWarnings({"unchecked", "deprecation", "all"}) 502 public static final class TrustedCertificateEntry implements java.security.KeyStore.Entry { 503 TrustedCertificateEntry(java.security.cert.Certificate trustedCert)504 public TrustedCertificateEntry(java.security.cert.Certificate trustedCert) { 505 throw new RuntimeException("Stub!"); 506 } 507 TrustedCertificateEntry( java.security.cert.Certificate trustedCert, java.util.Set<java.security.KeyStore.Entry.Attribute> attributes)508 public TrustedCertificateEntry( 509 java.security.cert.Certificate trustedCert, 510 java.util.Set<java.security.KeyStore.Entry.Attribute> attributes) { 511 throw new RuntimeException("Stub!"); 512 } 513 getTrustedCertificate()514 public java.security.cert.Certificate getTrustedCertificate() { 515 throw new RuntimeException("Stub!"); 516 } 517 getAttributes()518 public java.util.Set<java.security.KeyStore.Entry.Attribute> getAttributes() { 519 throw new RuntimeException("Stub!"); 520 } 521 toString()522 public java.lang.String toString() { 523 throw new RuntimeException("Stub!"); 524 } 525 526 private final java.util.Set<java.security.KeyStore.Entry.Attribute> attributes; 527 528 { 529 attributes = null; 530 } 531 532 private final java.security.cert.Certificate cert; 533 534 { 535 cert = null; 536 } 537 } 538 } 539