text:
.class abstract Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;
.super Ljavax/crypto/CipherSpi;
.source "AndroidKeyStoreCipherSpiBase.java"

# interfaces
.implements Landroid/security/keystore/KeyStoreCryptoOperation;

# instance fields
.field private mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

.field private mAdditionalAuthenticationDataStreamerClosed:Z

.field private mCachedException:Ljava/lang/Exception;

.field private mEncrypting:Z

.field private mKey:Landroid/security/keystore/AndroidKeyStoreKey;

.field private final mKeyStore:Landroid/security/KeyStore;

.field private mKeymasterPurposeOverride:I

.field private mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

.field private mOperationHandle:J

.field private mOperationToken:Landroid/os/IBinder;

.field private mRng:Ljava/security/SecureRandom;

# direct methods
.method constructor <init>()V
    .registers 2

    .prologue
    .line 94
    invoke-direct {p0}, Ljavax/crypto/CipherSpi;-><init>()V

    .line 71
    const/4 v0, -0x1

    iput v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    .line 95
    invoke-static {}, Landroid/security/KeyStore;->getInstance()Landroid/security/KeyStore;

    move-result-object v0

    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    .line 94
    return-void
.end method

.method private ensureKeystoreOperationInitialized()V
    .registers 11
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;,
            Ljava/security/InvalidAlgorithmParameterException;
        }
    .end annotation

    .prologue
    .line 225
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    if-eqz v0, :cond_5

    .line 226
    return-void

    .line 228
    :cond_5
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    if-eqz v0, :cond_a

    .line 229
    return-void

    .line 231
    :cond_a
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    if-nez v0, :cond_17

    .line 232
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string/jumbo v1, "Not initialized"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 235
    :cond_17
    new-instance v4, Landroid/security/keymaster/KeymasterArguments;

    invoke-direct {v4}, Landroid/security/keymaster/KeymasterArguments;-><init>()V

    .line 236
    .local v4, "keymasterInputArgs":Landroid/security/keymaster/KeymasterArguments;
    invoke-virtual {p0, v4}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->addAlgorithmSpecificParametersToBegin(Landroid/security/keymaster/KeymasterArguments;)V

    .line 238
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mRng:Ljava/security/SecureRandom;

    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->getAdditionalEntropyAmountForBegin()I

    move-result v1

    .line 237
    invoke-static {v0, v1}, Landroid/security/keystore/KeyStoreCryptoOperationUtils;->getRandomBytesToMixIntoKeystoreRng(Ljava/security/SecureRandom;I)[B

    move-result-object v5

    .line 241
    .local v5, "additionalEntropy":[B
    iget v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    const/4 v1, -0x1

    if-eq v0, v1, :cond_45

    .line 242
    iget v2, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    .line 247
    .local v2, "purpose":I
    :goto_30
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    .line 248
    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    invoke-virtual {v1}, Landroid/security/keystore/AndroidKeyStoreKey;->getAlias()Ljava/lang/String;

    move-result-object v1

    .line 250
    const/4 v3, 0x1

    .line 247
    invoke-virtual/range {v0 .. v5}, Landroid/security/KeyStore;->begin(Ljava/lang/String;IZLandroid/security/keymaster/KeymasterArguments;[B)Landroid/security/keymaster/OperationResult;

    move-result-object v7

    .line 253
    .local v7, "opResult":Landroid/security/keymaster/OperationResult;
    if-nez v7, :cond_4d

    .line 254
    new-instance v0, Landroid/security/keystore/KeyStoreConnectException;

    invoke-direct {v0}, Landroid/security/keystore/KeyStoreConnectException;-><init>()V

    throw v0

    .line 244
    .end local v2    # "purpose":I
    .end local v7    # "opResult":Landroid/security/keymaster/OperationResult;
    :cond_45
    iget-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mEncrypting:Z

    if-eqz v0, :cond_4b

    .line 245
    const/4 v2, 0x0

    .restart local v2    # "purpose":I
    goto :goto_30

    .end local v2    # "purpose":I
    :cond_4b
    const/4 v2, 0x1

    .restart local v2    # "purpose":I
    goto :goto_30

    .line 259
    .restart local v7    # "opResult":Landroid/security/keymaster/OperationResult;
    :cond_4d
    iget-object v0, v7, Landroid/security/keymaster/OperationResult;->token:Landroid/os/IBinder;

    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 260
    iget-wide v0, v7, Landroid/security/keymaster/OperationResult;->operationHandle:J

    iput-wide v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationHandle:J

    .line 264
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    iget v3, v7, Landroid/security/keymaster/OperationResult;->resultCode:I

    .line 263
    invoke-static {v0, v1, v3}, Landroid/security/keystore/KeyStoreCryptoOperationUtils;->getExceptionForCipherInit(Landroid/security/KeyStore;Landroid/security/keystore/AndroidKeyStoreKey;I)Ljava/security/GeneralSecurityException;

    move-result-object v6

    .line 265
    .local v6, "e":Ljava/security/GeneralSecurityException;
    if-eqz v6, :cond_78

    .line 266
    instance-of v0, v6, Ljava/security/InvalidKeyException;

    if-eqz v0, :cond_68

    .line 267
    check-cast v6, Ljava/security/InvalidKeyException;

    .end local v6    # "e":Ljava/security/GeneralSecurityException;
    throw v6

    .line 268
    .restart local v6    # "e":Ljava/security/GeneralSecurityException;
    :cond_68
    instance-of v0, v6, Ljava/security/InvalidAlgorithmParameterException;

    if-eqz v0, :cond_6f

    .line 269
    check-cast v6, Ljava/security/InvalidAlgorithmParameterException;

    .end local v6    # "e":Ljava/security/GeneralSecurityException;
    throw v6

    .line 271
    .restart local v6    # "e":Ljava/security/GeneralSecurityException;
    :cond_6f
    new-instance v0, Ljava/security/ProviderException;

    const-string/jumbo v1, "Unexpected exception type"

    invoke-direct {v0, v1, v6}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v0

    .line 275
    :cond_78
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    if-nez v0, :cond_85

    .line 276
    new-instance v0, Ljava/security/ProviderException;

    const-string/jumbo v1, "Keystore returned null operation token"

    invoke-direct {v0, v1}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 278
    :cond_85
    iget-wide v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationHandle:J

    const-wide/16 v8, 0x0

    cmp-long v0, v0, v8

    if-nez v0, :cond_96

    .line 279
    new-instance v0, Ljava/security/ProviderException;

    const-string/jumbo v1, "Keystore returned invalid operation handle"

    invoke-direct {v0, v1}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 282
    :cond_96
    iget-object v0, v7, Landroid/security/keymaster/OperationResult;->outParams:Landroid/security/keymaster/KeymasterArguments;

    invoke-virtual {p0, v0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->loadAlgorithmSpecificParametersFromBeginResult(Landroid/security/keymaster/KeymasterArguments;)V

    .line 283
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    iget-object v1, v7, Landroid/security/keymaster/OperationResult;->token:Landroid/os/IBinder;

    invoke-virtual {p0, v0, v1}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->createMainDataStreamer(Landroid/security/KeyStore;Landroid/os/IBinder;)Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    move-result-object v0

    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 285
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    iget-object v1, v7, Landroid/security/keymaster/OperationResult;->token:Landroid/os/IBinder;

    invoke-virtual {p0, v0, v1}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->createAdditionalAuthenticationDataStreamer(Landroid/security/KeyStore;Landroid/os/IBinder;)Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    move-result-object v0

    .line 284
    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 286
    const/4 v0, 0x0

    iput-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    .line 224
    return-void
.end method

.method private flushAAD()V
    .registers 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/security/KeyStoreException;
        }
    .end annotation

    .prologue
    const/4 v7, 0x1

    .line 350
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    if-eqz v0, :cond_9

    .line 351
    iget-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    if-eqz v0, :cond_a

    .line 349
    :cond_9
    return-void

    .line 354
    :cond_a
    :try_start_a
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 355
    sget-object v1, Llibcore/util/EmptyArray;->BYTE:[B

    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 356
    const/4 v4, 0x0

    .line 357
    const/4 v5, 0x0

    .line 354
    invoke-interface/range {v0 .. v5}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->doFinal([BII[B[B)[B
    :try_end_15
    .catchall {:try_start_a .. :try_end_15} :catchall_3f

    move-result-object v6

    .line 360
    .local v6, "output":[B
    iput-boolean v7, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    .line 362
    if-eqz v6, :cond_9

    array-length v0, v6

    if-lez v0, :cond_9

    .line 363
    new-instance v0, Ljava/security/ProviderException;

    .line 364
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "AAD update unexpectedly returned data: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    array-length v2, v6

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, " bytes"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    .line 363
    invoke-direct {v0, v1}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 359
    .end local v6    # "output":[B
    :catchall_3f
    move-exception v0

    .line 360
    iput-boolean v7, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    .line 359
    throw v0
.end method

.method private init(ILjava/security/Key;Ljava/security/SecureRandom;)V
    .registers 7
    .param p1, "opmode"    # I
    .param p2, "key"    # Ljava/security/Key;
    .param p3, "random"    # Ljava/security/SecureRandom;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;
        }
    .end annotation

    .prologue
    .line 157
    packed-switch p1, :pswitch_data_38

    .line 167
    new-instance v0, Ljava/security/InvalidParameterException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "Unsupported opmode: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v1}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 160
    :pswitch_1d
    const/4 v0, 0x1

    iput-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mEncrypting:Z

    .line 169
    :goto_20
    invoke-virtual {p0, p1, p2}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->initKey(ILjava/security/Key;)V

    .line 170
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    if-nez v0, :cond_34

    .line 171
    new-instance v0, Ljava/security/ProviderException;

    const-string/jumbo v1, "initKey did not initialize the key"

    invoke-direct {v0, v1}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 164
    :pswitch_30
    const/4 v0, 0x0

    iput-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mEncrypting:Z

    goto :goto_20

    .line 173
    :cond_34
    iput-object p3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mRng:Ljava/security/SecureRandom;

    .line 156
    return-void

    .line 157
    nop

    :pswitch_data_38
    .packed-switch 0x1
        :pswitch_1d
        :pswitch_30
        :pswitch_1d
        :pswitch_30
    .end packed-switch
.end method

.method static opmodeToString(I)Ljava/lang/String;
    .registers 2
    .param p0, "opmode"    # I

    .prologue
    .line 735
    packed-switch p0, :pswitch_data_18

    .line 745
    invoke-static {p0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    return-object v0

    .line 737
    :pswitch_8
    const-string/jumbo v0, "ENCRYPT_MODE"

    return-object v0

    .line 739
    :pswitch_c
    const-string/jumbo v0, "DECRYPT_MODE"

    return-object v0

    .line 741
    :pswitch_10
    const-string/jumbo v0, "WRAP_MODE"

    return-object v0

    .line 743
    :pswitch_14
    const-string/jumbo v0, "UNWRAP_MODE"

    return-object v0

    .line 735
    :pswitch_data_18
    .packed-switch 0x1
        :pswitch_8
        :pswitch_c
        :pswitch_10
        :pswitch_14
    .end packed-switch
.end method

# virtual methods
.method protected abstract addAlgorithmSpecificParametersToBegin(Landroid/security/keymaster/KeymasterArguments;)V
.end method

.method protected createAdditionalAuthenticationDataStreamer(Landroid/security/KeyStore;Landroid/os/IBinder;)Landroid/security/keystore/KeyStoreCryptoOperationStreamer;
    .registers 4
    .param p1, "keyStore"    # Landroid/security/KeyStore;
    .param p2, "operationToken"    # Landroid/os/IBinder;

    .prologue
    .line 314
    const/4 v0, 0x0

    return-object v0
.end method

.method protected createMainDataStreamer(Landroid/security/KeyStore;Landroid/os/IBinder;)Landroid/security/keystore/KeyStoreCryptoOperationStreamer;
    .registers 5
    .param p1, "keyStore"    # Landroid/security/KeyStore;
    .param p2, "operationToken"    # Landroid/os/IBinder;

    .prologue
    .line 298
    new-instance v0, Landroid/security/keystore/KeyStoreCryptoOperationChunkedStreamer;

    .line 299
    new-instance v1, Landroid/security/keystore/KeyStoreCryptoOperationChunkedStreamer$MainDataStream;

    invoke-direct {v1, p1, p2}, Landroid/security/keystore/KeyStoreCryptoOperationChunkedStreamer$MainDataStream;-><init>(Landroid/security/KeyStore;Landroid/os/IBinder;)V

    .line 298
    invoke-direct {v0, v1}, Landroid/security/keystore/KeyStoreCryptoOperationChunkedStreamer;-><init>(Landroid/security/keystore/KeyStoreCryptoOperationChunkedStreamer$Stream;)V

    return-object v0
.end method

.method protected final engineDoFinal(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
    .registers 4
    .param p1, "input"    # Ljava/nio/ByteBuffer;
    .param p2, "output"    # Ljava/nio/ByteBuffer;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/ShortBufferException;,
            Ljavax/crypto/IllegalBlockSizeException;,
            Ljavax/crypto/BadPaddingException;
        }
    .end annotation

    .prologue
    .line 514
    invoke-super {p0, p1, p2}, Ljavax/crypto/CipherSpi;->engineDoFinal(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I

    move-result v0

    return v0
.end method

.method protected final engineDoFinal([BII[BI)I
    .registers 11
    .param p1, "input"    # [B
    .param p2, "inputOffset"    # I
    .param p3, "inputLen"    # I
    .param p4, "output"    # [B
    .param p5, "outputOffset"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/ShortBufferException;,
            Ljavax/crypto/IllegalBlockSizeException;,
            Ljavax/crypto/BadPaddingException;
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    .line 498
    invoke-virtual {p0, p1, p2, p3}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->engineDoFinal([BII)[B

    move-result-object v1

    .line 499
    .local v1, "outputCopy":[B
    if-nez v1, :cond_8

    .line 500
    return v3

    .line 502
    :cond_8
    array-length v2, p4

    sub-int v0, v2, p5

    .line 503
    .local v0, "outputAvailable":I
    array-length v2, v1

    if-le v2, v0, :cond_34

    .line 504
    new-instance v2, Ljavax/crypto/ShortBufferException;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v4, "Output buffer too short. Produced: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 505
    array-length v4, v1

    .line 504
    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 505
    const-string/jumbo v4, ", available: "

    .line 504
    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljavax/crypto/ShortBufferException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 507
    :cond_34
    array-length v2, v1

    invoke-static {v1, v3, p4, p5, v2}, Ljava/lang/System;->arraycopy([BI[BII)V

    .line 508
    array-length v2, v1

    return v2
.end method

.method protected final engineDoFinal([BII)[B
    .registers 13
    .param p1, "input"    # [B
    .param p2, "inputOffset"    # I
    .param p3, "inputLen"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/IllegalBlockSizeException;,
            Ljavax/crypto/BadPaddingException;
        }
    .end annotation

    .prologue
    .line 456
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    if-eqz v0, :cond_12

    .line 458
    new-instance v0, Ljavax/crypto/IllegalBlockSizeException;

    invoke-direct {v0}, Ljavax/crypto/IllegalBlockSizeException;-><init>()V

    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    invoke-virtual {v0, v1}, Ljavax/crypto/IllegalBlockSizeException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    .line 457
    check-cast v0, Ljavax/crypto/IllegalBlockSizeException;

    throw v0

    .line 462
    :cond_12
    :try_start_12
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_15
    .catch Ljava/security/InvalidKeyException; {:try_start_12 .. :try_end_15} :catch_30
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_12 .. :try_end_15} :catch_30

    .line 469
    :try_start_15
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->flushAAD()V

    .line 472
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mRng:Ljava/security/SecureRandom;

    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->getAdditionalEntropyAmountForFinish()I

    move-result v1

    .line 471
    invoke-static {v0, v1}, Landroid/security/keystore/KeyStoreCryptoOperationUtils;->getRandomBytesToMixIntoKeystoreRng(Ljava/security/SecureRandom;I)[B

    move-result-object v5

    .line 473
    .local v5, "additionalEntropy":[B
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 475
    const/4 v4, 0x0

    move-object v1, p1

    move v2, p2

    move v3, p3

    .line 473
    invoke-interface/range {v0 .. v5}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->doFinal([BII[B[B)[B
    :try_end_2b
    .catch Landroid/security/KeyStoreException; {:try_start_15 .. :try_end_2b} :catch_3d

    move-result-object v8

    .line 490
    .local v8, "output":[B
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetWhilePreservingInitState()V

    .line 491
    return-object v8

    .line 463
    .end local v5    # "additionalEntropy":[B
    .end local v8    # "output":[B
    :catch_30
    move-exception v7

    .line 464
    .local v7, "e":Ljava/security/GeneralSecurityException;
    new-instance v0, Ljavax/crypto/IllegalBlockSizeException;

    invoke-direct {v0}, Ljavax/crypto/IllegalBlockSizeException;-><init>()V

    invoke-virtual {v0, v7}, Ljavax/crypto/IllegalBlockSizeException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    check-cast v0, Ljavax/crypto/IllegalBlockSizeException;

    throw v0

    .line 477
    .end local v7    # "e":Ljava/security/GeneralSecurityException;
    :catch_3d
    move-exception v6

    .line 478
    .local v6, "e":Landroid/security/KeyStoreException;
    invoke-virtual {v6}, Landroid/security/KeyStoreException;->getErrorCode()I

    move-result v0

    sparse-switch v0, :sswitch_data_76

    .line 486
    new-instance v0, Ljavax/crypto/IllegalBlockSizeException;

    invoke-direct {v0}, Ljavax/crypto/IllegalBlockSizeException;-><init>()V

    invoke-virtual {v0, v6}, Ljavax/crypto/IllegalBlockSizeException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    check-cast v0, Ljavax/crypto/IllegalBlockSizeException;

    throw v0

    .line 480
    :sswitch_51
    new-instance v0, Ljavax/crypto/IllegalBlockSizeException;

    invoke-direct {v0}, Ljavax/crypto/IllegalBlockSizeException;-><init>()V

    invoke-virtual {v0, v6}, Ljavax/crypto/IllegalBlockSizeException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    check-cast v0, Ljavax/crypto/IllegalBlockSizeException;

    throw v0

    .line 482
    :sswitch_5d
    new-instance v0, Ljavax/crypto/BadPaddingException;

    invoke-direct {v0}, Ljavax/crypto/BadPaddingException;-><init>()V

    invoke-virtual {v0, v6}, Ljavax/crypto/BadPaddingException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    check-cast v0, Ljavax/crypto/BadPaddingException;

    throw v0

    .line 484
    :sswitch_69
    new-instance v0, Ljavax/crypto/AEADBadTagException;

    invoke-direct {v0}, Ljavax/crypto/AEADBadTagException;-><init>()V

    invoke-virtual {v0, v6}, Ljavax/crypto/AEADBadTagException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v0

    check-cast v0, Ljavax/crypto/AEADBadTagException;

    throw v0

    .line 478
    nop

    :sswitch_data_76
    .sparse-switch
        -0x26 -> :sswitch_5d
        -0x1e -> :sswitch_69
        -0x15 -> :sswitch_51
    .end sparse-switch
.end method

.method protected final engineGetKeySize(Ljava/security/Key;)I
    .registers 3
    .param p1, "key"    # Ljava/security/Key;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;
        }
    .end annotation

    .prologue
    .line 671
    new-instance v0, Ljava/lang/UnsupportedOperationException;

    invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V

    throw v0
.end method

.method protected abstract engineGetParameters()Ljava/security/AlgorithmParameters;
.end method

.method protected final engineInit(ILjava/security/Key;Ljava/security/AlgorithmParameters;Ljava/security/SecureRandom;)V
    .registers 7
    .param p1, "opmode"    # I
    .param p2, "key"    # Ljava/security/Key;
    .param p3, "params"    # Ljava/security/AlgorithmParameters;
    .param p4, "random"    # Ljava/security/SecureRandom;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;,
            Ljava/security/InvalidAlgorithmParameterException;
        }
    .end annotation

    .prologue
    .line 123
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 125
    const/4 v0, 0x0

    .line 127
    .local v0, "success":Z
    :try_start_4
    invoke-direct {p0, p1, p2, p4}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->init(ILjava/security/Key;Ljava/security/SecureRandom;)V

    .line 128
    invoke-virtual {p0, p3}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->initAlgorithmSpecificParameters(Ljava/security/AlgorithmParameters;)V

    .line 129
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_d
    .catchall {:try_start_4 .. :try_end_d} :catchall_14

    .line 130
    const/4 v0, 0x1

    .line 132
    if-nez v0, :cond_13

    .line 133
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 122
    :cond_13
    return-void

    .line 131
    :catchall_14
    move-exception v1

    .line 132
    if-nez v0, :cond_1a

    .line 133
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 131
    :cond_1a
    throw v1
.end method

.method protected final engineInit(ILjava/security/Key;Ljava/security/SecureRandom;)V
    .registers 7
    .param p1, "opmode"    # I
    .param p2, "key"    # Ljava/security/Key;
    .param p3, "random"    # Ljava/security/SecureRandom;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;
        }
    .end annotation

    .prologue
    .line 101
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 103
    const/4 v1, 0x0

    .line 105
    .local v1, "success":Z
    :try_start_4
    invoke-direct {p0, p1, p2, p3}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->init(ILjava/security/Key;Ljava/security/SecureRandom;)V

    .line 106
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->initAlgorithmSpecificParameters()V
    :try_end_a
    .catchall {:try_start_4 .. :try_end_a} :catchall_1b

    .line 108
    :try_start_a
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_d
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_a .. :try_end_d} :catch_14
    .catchall {:try_start_a .. :try_end_d} :catchall_1b

    .line 112
    const/4 v1, 0x1

    .line 114
    if-nez v1, :cond_13

    .line 115
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 100
    :cond_13
    return-void

    .line 109
    :catch_14
    move-exception v0

    .line 110
    .local v0, "e":Ljava/security/InvalidAlgorithmParameterException;
    :try_start_15
    new-instance v2, Ljava/security/InvalidKeyException;

    invoke-direct {v2, v0}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/Throwable;)V

    throw v2
    :try_end_1b
    .catchall {:try_start_15 .. :try_end_1b} :catchall_1b

    .line 113
    .end local v0    # "e":Ljava/security/InvalidAlgorithmParameterException;
    :catchall_1b
    move-exception v2

    .line 114
    if-nez v1, :cond_21

    .line 115
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 113
    :cond_21
    throw v2
.end method

.method protected final engineInit(ILjava/security/Key;Ljava/security/spec/AlgorithmParameterSpec;Ljava/security/SecureRandom;)V
    .registers 7
    .param p1, "opmode"    # I
    .param p2, "key"    # Ljava/security/Key;
    .param p3, "params"    # Ljava/security/spec/AlgorithmParameterSpec;
    .param p4, "random"    # Ljava/security/SecureRandom;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;,
            Ljava/security/InvalidAlgorithmParameterException;
        }
    .end annotation

    .prologue
    .line 141
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 143
    const/4 v0, 0x0

    .line 145
    .local v0, "success":Z
    :try_start_4
    invoke-direct {p0, p1, p2, p4}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->init(ILjava/security/Key;Ljava/security/SecureRandom;)V

    .line 146
    invoke-virtual {p0, p3}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->initAlgorithmSpecificParameters(Ljava/security/spec/AlgorithmParameterSpec;)V

    .line 147
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_d
    .catchall {:try_start_4 .. :try_end_d} :catchall_14

    .line 148
    const/4 v0, 0x1

    .line 150
    if-nez v0, :cond_13

    .line 151
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 140
    :cond_13
    return-void

    .line 149
    :catchall_14
    move-exception v1

    .line 150
    if-nez v0, :cond_1a

    .line 151
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->resetAll()V

    .line 149
    :cond_1a
    throw v1
.end method

.method protected final engineSetMode(Ljava/lang/String;)V
    .registers 3
    .param p1, "mode"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/NoSuchAlgorithmException;
        }
    .end annotation

    .prologue
    .line 659
    new-instance v0, Ljava/lang/UnsupportedOperationException;

    invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V

    throw v0
.end method

.method protected final engineSetPadding(Ljava/lang/String;)V
    .registers 3
    .param p1, "arg0"    # Ljava/lang/String;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/NoSuchPaddingException;
        }
    .end annotation

    .prologue
    .line 666
    new-instance v0, Ljava/lang/UnsupportedOperationException;

    invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V

    throw v0
.end method

.method protected final engineUnwrap([BLjava/lang/String;I)Ljava/security/Key;
    .registers 11
    .param p1, "wrappedKey"    # [B
    .param p2, "wrappedKeyAlgorithm"    # Ljava/lang/String;
    .param p3, "wrappedKeyType"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;,
            Ljava/security/NoSuchAlgorithmException;
        }
    .end annotation

    .prologue
    .line 601
    iget-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    if-nez v4, :cond_d

    .line 602
    new-instance v4, Ljava/lang/IllegalStateException;

    const-string/jumbo v5, "Not initilized"

    invoke-direct {v4, v5}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 605
    :cond_d
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->isEncrypting()Z

    move-result v4

    if-eqz v4, :cond_1c

    .line 606
    new-instance v4, Ljava/lang/IllegalStateException;

    .line 607
    const-string/jumbo v5, "Cipher must be initialized in Cipher.WRAP_MODE to wrap keys"

    .line 606
    invoke-direct {v4, v5}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 610
    :cond_1c
    if-nez p1, :cond_27

    .line 611
    new-instance v4, Ljava/lang/NullPointerException;

    const-string/jumbo v5, "wrappedKey == null"

    invoke-direct {v4, v5}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 616
    :cond_27
    :try_start_27
    array-length v4, p1

    const/4 v5, 0x0

    invoke-virtual {p0, p1, v5, v4}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->engineDoFinal([BII)[B
    :try_end_2c
    .catch Ljavax/crypto/IllegalBlockSizeException; {:try_start_27 .. :try_end_2c} :catch_4a
    .catch Ljavax/crypto/BadPaddingException; {:try_start_27 .. :try_end_2c} :catch_4a

    move-result-object v2

    .line 621
    .local v2, "encoded":[B
    packed-switch p3, :pswitch_data_8a

    .line 650
    new-instance v4, Ljava/security/InvalidParameterException;

    .line 651
    new-instance v5, Ljava/lang/StringBuilder;

    invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v6, "Unsupported wrappedKeyType: "

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    .line 650
    invoke-direct {v4, v5}, Ljava/security/InvalidParameterException;-><init>(Ljava/lang/String;)V

    throw v4

    .line 617
    .end local v2    # "encoded":[B
    :catch_4a
    move-exception v0

    .line 618
    .local v0, "e":Ljava/security/GeneralSecurityException;
    new-instance v4, Ljava/security/InvalidKeyException;

    const-string/jumbo v5, "Failed to unwrap key"

    invoke-direct {v4, v5, v0}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v4

    .line 624
    .end local v0    # "e":Ljava/security/GeneralSecurityException;
    .restart local v2    # "encoded":[B
    :pswitch_54
    new-instance v4, Ljavax/crypto/spec/SecretKeySpec;

    invoke-direct {v4, v2, p2}, Ljavax/crypto/spec/SecretKeySpec;-><init>([BLjava/lang/String;)V

    return-object v4

    .line 629
    :pswitch_5a
    invoke-static {p2}, Ljava/security/KeyFactory;->getInstance(Ljava/lang/String;)Ljava/security/KeyFactory;

    move-result-object v3

    .line 631
    .local v3, "keyFactory":Ljava/security/KeyFactory;
    :try_start_5e
    new-instance v4, Ljava/security/spec/PKCS8EncodedKeySpec;

    invoke-direct {v4, v2}, Ljava/security/spec/PKCS8EncodedKeySpec;-><init>([B)V

    invoke-virtual {v3, v4}, Ljava/security/KeyFactory;->generatePrivate(Ljava/security/spec/KeySpec;)Ljava/security/PrivateKey;
    :try_end_66
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_5e .. :try_end_66} :catch_68

    move-result-object v4

    return-object v4

    .line 632
    :catch_68
    move-exception v1

    .line 633
    .local v1, "e":Ljava/security/spec/InvalidKeySpecException;
    new-instance v4, Ljava/security/InvalidKeyException;

    .line 634
    const-string/jumbo v5, "Failed to create private key from its PKCS#8 encoded form"

    .line 633
    invoke-direct {v4, v5, v1}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v4

    .line 640
    .end local v1    # "e":Ljava/security/spec/InvalidKeySpecException;
    .end local v3    # "keyFactory":Ljava/security/KeyFactory;
    :pswitch_72
    invoke-static {p2}, Ljava/security/KeyFactory;->getInstance(Ljava/lang/String;)Ljava/security/KeyFactory;

    move-result-object v3

    .line 642
    .restart local v3    # "keyFactory":Ljava/security/KeyFactory;
    :try_start_76
    new-instance v4, Ljava/security/spec/X509EncodedKeySpec;

    invoke-direct {v4, v2}, Ljava/security/spec/X509EncodedKeySpec;-><init>([B)V

    invoke-virtual {v3, v4}, Ljava/security/KeyFactory;->generatePublic(Ljava/security/spec/KeySpec;)Ljava/security/PublicKey;
    :try_end_7e
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_76 .. :try_end_7e} :catch_80

    move-result-object v4

    return-object v4

    .line 643
    :catch_80
    move-exception v1

    .line 644
    .restart local v1    # "e":Ljava/security/spec/InvalidKeySpecException;
    new-instance v4, Ljava/security/InvalidKeyException;

    .line 645
    const-string/jumbo v5, "Failed to create public key from its X.509 encoded form"

    .line 644
    invoke-direct {v4, v5, v1}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v4

    .line 621
    :pswitch_data_8a
    .packed-switch 0x1
        :pswitch_72
        :pswitch_5a
        :pswitch_54
    .end packed-switch
.end method

.method protected final engineUpdate(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I
    .registers 4
    .param p1, "input"    # Ljava/nio/ByteBuffer;
    .param p2, "output"    # Ljava/nio/ByteBuffer;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/ShortBufferException;
        }
    .end annotation

    .prologue
    .line 388
    invoke-super {p0, p1, p2}, Ljavax/crypto/CipherSpi;->engineUpdate(Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)I

    move-result v0

    return v0
.end method

.method protected final engineUpdate([BII[BI)I
    .registers 11
    .param p1, "input"    # [B
    .param p2, "inputOffset"    # I
    .param p3, "inputLen"    # I
    .param p4, "output"    # [B
    .param p5, "outputOffset"    # I
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/ShortBufferException;
        }
    .end annotation

    .prologue
    const/4 v3, 0x0

    .line 372
    invoke-virtual {p0, p1, p2, p3}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->engineUpdate([BII)[B

    move-result-object v1

    .line 373
    .local v1, "outputCopy":[B
    if-nez v1, :cond_8

    .line 374
    return v3

    .line 376
    :cond_8
    array-length v2, p4

    sub-int v0, v2, p5

    .line 377
    .local v0, "outputAvailable":I
    array-length v2, v1

    if-le v2, v0, :cond_34

    .line 378
    new-instance v2, Ljavax/crypto/ShortBufferException;

    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v4, "Output buffer too short. Produced: "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 379
    array-length v4, v1

    .line 378
    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    .line 379
    const-string/jumbo v4, ", available: "

    .line 378
    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-direct {v2, v3}, Ljavax/crypto/ShortBufferException;-><init>(Ljava/lang/String;)V

    throw v2

    .line 381
    :cond_34
    array-length v2, v1

    invoke-static {v1, v3, p4, p5, v2}, Ljava/lang/System;->arraycopy([BI[BII)V

    .line 382
    array-length v2, v1

    return v2
.end method

.method protected final engineUpdate([BII)[B
    .registers 9
    .param p1, "input"    # [B
    .param p2, "inputOffset"    # I
    .param p3, "inputLen"    # I

    .prologue
    const/4 v4, 0x0

    .line 319
    iget-object v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    if-eqz v3, :cond_6

    .line 320
    return-object v4

    .line 323
    :cond_6
    :try_start_6
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_9
    .catch Ljava/security/InvalidKeyException; {:try_start_6 .. :try_end_9} :catch_c
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_6 .. :try_end_9} :catch_c

    .line 329
    if-nez p3, :cond_10

    .line 330
    return-object v4

    .line 324
    :catch_c
    move-exception v1

    .line 325
    .local v1, "e":Ljava/security/GeneralSecurityException;
    iput-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 326
    return-object v4

    .line 335
    .end local v1    # "e":Ljava/security/GeneralSecurityException;
    :cond_10
    :try_start_10
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->flushAAD()V

    .line 336
    iget-object v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    invoke-interface {v3, p1, p2, p3}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->update([BII)[B
    :try_end_18
    .catch Landroid/security/KeyStoreException; {:try_start_10 .. :try_end_18} :catch_1d

    move-result-object v2

    .line 342
    .local v2, "output":[B
    array-length v3, v2

    if-nez v3, :cond_21

    .line 343
    return-object v4

    .line 337
    .end local v2    # "output":[B
    :catch_1d
    move-exception v0

    .line 338
    .local v0, "e":Landroid/security/KeyStoreException;
    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 339
    return-object v4

    .line 346
    .end local v0    # "e":Landroid/security/KeyStoreException;
    .restart local v2    # "output":[B
    :cond_21
    return-object v2
.end method

.method protected final engineUpdateAAD(Ljava/nio/ByteBuffer;)V
    .registers 7
    .param p1, "src"    # Ljava/nio/ByteBuffer;

    .prologue
    .line 429
    if-nez p1, :cond_b

    .line 430
    new-instance v3, Ljava/lang/IllegalArgumentException;

    const-string/jumbo v4, "src == null"

    invoke-direct {v3, v4}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 432
    :cond_b
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasRemaining()Z

    move-result v3

    if-nez v3, :cond_12

    .line 433
    return-void

    .line 439
    :cond_12
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->hasArray()Z

    move-result v3

    if-eqz v3, :cond_35

    .line 440
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->array()[B

    move-result-object v0

    .line 441
    .local v0, "input":[B
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->arrayOffset()I

    move-result v3

    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->position()I

    move-result v4

    add-int v2, v3, v4

    .line 442
    .local v2, "inputOffset":I
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v1

    .line 443
    .local v1, "inputLen":I
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->limit()I

    move-result v3

    invoke-virtual {p1, v3}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;

    .line 450
    :goto_31
    invoke-virtual {p0, v0, v2, v1}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->engineUpdateAAD([BII)V

    .line 428
    return-void

    .line 445
    .end local v0    # "input":[B
    .end local v1    # "inputLen":I
    .end local v2    # "inputOffset":I
    :cond_35
    invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v3

    new-array v0, v3, [B

    .line 446
    .restart local v0    # "input":[B
    const/4 v2, 0x0

    .line 447
    .restart local v2    # "inputOffset":I
    array-length v1, v0

    .line 448
    .restart local v1    # "inputLen":I
    invoke-virtual {p1, v0}, Ljava/nio/ByteBuffer;->get([B)Ljava/nio/ByteBuffer;

    goto :goto_31
.end method

.method protected final engineUpdateAAD([BII)V
    .registers 10
    .param p1, "input"    # [B
    .param p2, "inputOffset"    # I
    .param p3, "inputLen"    # I

    .prologue
    .line 393
    iget-object v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    if-eqz v3, :cond_5

    .line 394
    return-void

    .line 398
    :cond_5
    :try_start_5
    invoke-direct {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->ensureKeystoreOperationInitialized()V
    :try_end_8
    .catch Ljava/security/InvalidKeyException; {:try_start_5 .. :try_end_8} :catch_15
    .catch Ljava/security/InvalidAlgorithmParameterException; {:try_start_5 .. :try_end_8} :catch_15

    .line 404
    iget-boolean v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    if-eqz v3, :cond_19

    .line 405
    new-instance v3, Ljava/lang/IllegalStateException;

    .line 406
    const-string/jumbo v4, "AAD can only be provided before Cipher.update is invoked"

    .line 405
    invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 399
    :catch_15
    move-exception v1

    .line 400
    .local v1, "e":Ljava/security/GeneralSecurityException;
    iput-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 401
    return-void

    .line 409
    .end local v1    # "e":Ljava/security/GeneralSecurityException;
    :cond_19
    iget-object v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    if-nez v3, :cond_26

    .line 410
    new-instance v3, Ljava/lang/IllegalStateException;

    const-string/jumbo v4, "This cipher does not support AAD"

    invoke-direct {v3, v4}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 415
    :cond_26
    :try_start_26
    iget-object v3, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    invoke-interface {v3, p1, p2, p3}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->update([BII)[B
    :try_end_2b
    .catch Landroid/security/KeyStoreException; {:try_start_26 .. :try_end_2b} :catch_53

    move-result-object v2

    .line 421
    .local v2, "output":[B
    if-eqz v2, :cond_57

    array-length v3, v2

    if-lez v3, :cond_57

    .line 422
    new-instance v3, Ljava/security/ProviderException;

    new-instance v4, Ljava/lang/StringBuilder;

    invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v5, "AAD update unexpectedly produced output: "

    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    .line 423
    array-length v5, v2

    .line 422
    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v4

    .line 423
    const-string/jumbo v5, " bytes"

    .line 422
    invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v4

    invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v4

    invoke-direct {v3, v4}, Ljava/security/ProviderException;-><init>(Ljava/lang/String;)V

    throw v3

    .line 416
    .end local v2    # "output":[B
    :catch_53
    move-exception v0

    .line 417
    .local v0, "e":Landroid/security/KeyStoreException;
    iput-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 418
    return-void

    .line 392
    .end local v0    # "e":Landroid/security/KeyStoreException;
    .restart local v2    # "output":[B
    :cond_57
    return-void
.end method

.method protected final engineWrap(Ljava/security/Key;)[B
    .registers 13
    .param p1, "key"    # Ljava/security/Key;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljavax/crypto/IllegalBlockSizeException;,
            Ljava/security/InvalidKeyException;
        }
    .end annotation

    .prologue
    .line 520
    iget-object v8, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    if-nez v8, :cond_d

    .line 521
    new-instance v8, Ljava/lang/IllegalStateException;

    const-string/jumbo v9, "Not initilized"

    invoke-direct {v8, v9}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 524
    :cond_d
    invoke-virtual {p0}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->isEncrypting()Z

    move-result v8

    if-nez v8, :cond_1c

    .line 525
    new-instance v8, Ljava/lang/IllegalStateException;

    .line 526
    const-string/jumbo v9, "Cipher must be initialized in Cipher.WRAP_MODE to wrap keys"

    .line 525
    invoke-direct {v8, v9}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 529
    :cond_1c
    if-nez p1, :cond_27

    .line 530
    new-instance v8, Ljava/lang/NullPointerException;

    const-string/jumbo v9, "key == null"

    invoke-direct {v8, v9}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 532
    :cond_27
    const/4 v2, 0x0

    .line 533
    .local v2, "encoded":[B
    instance-of v8, p1, Ljavax/crypto/SecretKey;

    if-eqz v8, :cond_6a

    .line 534
    const-string/jumbo v8, "RAW"

    invoke-interface {p1}, Ljava/security/Key;->getFormat()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_3d

    .line 535
    invoke-interface {p1}, Ljava/security/Key;->getEncoded()[B

    move-result-object v2

    .line 537
    .end local v2    # "encoded":[B
    :cond_3d
    if-nez v2, :cond_55

    .line 539
    :try_start_3f
    invoke-interface {p1}, Ljava/security/Key;->getAlgorithm()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Ljavax/crypto/SecretKeyFactory;->getInstance(Ljava/lang/String;)Ljavax/crypto/SecretKeyFactory;

    move-result-object v4

    .line 542
    .local v4, "keyFactory":Ljavax/crypto/SecretKeyFactory;
    check-cast p1, Ljavax/crypto/SecretKey;

    .end local p1    # "key":Ljava/security/Key;
    const-class v8, Ljavax/crypto/spec/SecretKeySpec;

    .line 541
    invoke-virtual {v4, p1, v8}, Ljavax/crypto/SecretKeyFactory;->getKeySpec(Ljavax/crypto/SecretKey;Ljava/lang/Class;)Ljava/security/spec/KeySpec;

    move-result-object v7

    check-cast v7, Ljavax/crypto/spec/SecretKeySpec;

    .line 543
    .local v7, "spec":Ljavax/crypto/spec/SecretKeySpec;
    invoke-virtual {v7}, Ljavax/crypto/spec/SecretKeySpec;->getEncoded()[B
    :try_end_54
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_3f .. :try_end_54} :catch_60
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_3f .. :try_end_54} :catch_60

    move-result-object v2

    .line 586
    .end local v4    # "keyFactory":Ljavax/crypto/SecretKeyFactory;
    .end local v7    # "spec":Ljavax/crypto/spec/SecretKeySpec;
    :cond_55
    :goto_55
    if-nez v2, :cond_f8

    .line 587
    new-instance v8, Ljava/security/InvalidKeyException;

    .line 588
    const-string/jumbo v9, "Failed to wrap key because it does not export its key material"

    .line 587
    invoke-direct {v8, v9}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 544
    :catch_60
    move-exception v0

    .line 545
    .local v0, "e":Ljava/security/GeneralSecurityException;
    new-instance v8, Ljava/security/InvalidKeyException;

    .line 546
    const-string/jumbo v9, "Failed to wrap key because it does not export its key material"

    .line 545
    invoke-direct {v8, v9, v0}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v8

    .line 550
    .end local v0    # "e":Ljava/security/GeneralSecurityException;
    .restart local v2    # "encoded":[B
    .restart local p1    # "key":Ljava/security/Key;
    :cond_6a
    instance-of v8, p1, Ljava/security/PrivateKey;

    if-eqz v8, :cond_a0

    .line 551
    const-string/jumbo v8, "PKCS8"

    invoke-interface {p1}, Ljava/security/Key;->getFormat()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_7f

    .line 552
    invoke-interface {p1}, Ljava/security/Key;->getEncoded()[B

    move-result-object v2

    .line 554
    .end local v2    # "encoded":[B
    :cond_7f
    if-nez v2, :cond_55

    .line 556
    :try_start_81
    invoke-interface {p1}, Ljava/security/Key;->getAlgorithm()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Ljava/security/KeyFactory;->getInstance(Ljava/lang/String;)Ljava/security/KeyFactory;

    move-result-object v3

    .line 558
    .local v3, "keyFactory":Ljava/security/KeyFactory;
    const-class v8, Ljava/security/spec/PKCS8EncodedKeySpec;

    invoke-virtual {v3, p1, v8}, Ljava/security/KeyFactory;->getKeySpec(Ljava/security/Key;Ljava/lang/Class;)Ljava/security/spec/KeySpec;

    move-result-object v5

    check-cast v5, Ljava/security/spec/PKCS8EncodedKeySpec;

    .line 559
    .local v5, "spec":Ljava/security/spec/PKCS8EncodedKeySpec;
    invoke-virtual {v5}, Ljava/security/spec/PKCS8EncodedKeySpec;->getEncoded()[B
    :try_end_94
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_81 .. :try_end_94} :catch_96
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_81 .. :try_end_94} :catch_96

    move-result-object v2

    .local v2, "encoded":[B
    goto :goto_55

    .line 560
    .end local v2    # "encoded":[B
    .end local v3    # "keyFactory":Ljava/security/KeyFactory;
    .end local v5    # "spec":Ljava/security/spec/PKCS8EncodedKeySpec;
    :catch_96
    move-exception v0

    .line 561
    .restart local v0    # "e":Ljava/security/GeneralSecurityException;
    new-instance v8, Ljava/security/InvalidKeyException;

    .line 562
    const-string/jumbo v9, "Failed to wrap key because it does not export its key material"

    .line 561
    invoke-direct {v8, v9, v0}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v8

    .line 566
    .end local v0    # "e":Ljava/security/GeneralSecurityException;
    .local v2, "encoded":[B
    :cond_a0
    instance-of v8, p1, Ljava/security/PublicKey;

    if-eqz v8, :cond_d6

    .line 567
    const-string/jumbo v8, "X.509"

    invoke-interface {p1}, Ljava/security/Key;->getFormat()Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v8, v9}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v8

    if-eqz v8, :cond_b5

    .line 568
    invoke-interface {p1}, Ljava/security/Key;->getEncoded()[B

    move-result-object v2

    .line 570
    .end local v2    # "encoded":[B
    :cond_b5
    if-nez v2, :cond_55

    .line 572
    :try_start_b7
    invoke-interface {p1}, Ljava/security/Key;->getAlgorithm()Ljava/lang/String;

    move-result-object v8

    invoke-static {v8}, Ljava/security/KeyFactory;->getInstance(Ljava/lang/String;)Ljava/security/KeyFactory;

    move-result-object v3

    .line 574
    .restart local v3    # "keyFactory":Ljava/security/KeyFactory;
    const-class v8, Ljava/security/spec/X509EncodedKeySpec;

    invoke-virtual {v3, p1, v8}, Ljava/security/KeyFactory;->getKeySpec(Ljava/security/Key;Ljava/lang/Class;)Ljava/security/spec/KeySpec;

    move-result-object v6

    check-cast v6, Ljava/security/spec/X509EncodedKeySpec;

    .line 575
    .local v6, "spec":Ljava/security/spec/X509EncodedKeySpec;
    invoke-virtual {v6}, Ljava/security/spec/X509EncodedKeySpec;->getEncoded()[B
    :try_end_ca
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_b7 .. :try_end_ca} :catch_cc
    .catch Ljava/security/spec/InvalidKeySpecException; {:try_start_b7 .. :try_end_ca} :catch_cc

    move-result-object v2

    .local v2, "encoded":[B
    goto :goto_55

    .line 576
    .end local v2    # "encoded":[B
    .end local v3    # "keyFactory":Ljava/security/KeyFactory;
    .end local v6    # "spec":Ljava/security/spec/X509EncodedKeySpec;
    :catch_cc
    move-exception v0

    .line 577
    .restart local v0    # "e":Ljava/security/GeneralSecurityException;
    new-instance v8, Ljava/security/InvalidKeyException;

    .line 578
    const-string/jumbo v9, "Failed to wrap key because it does not export its key material"

    .line 577
    invoke-direct {v8, v9, v0}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v8

    .line 583
    .end local v0    # "e":Ljava/security/GeneralSecurityException;
    .local v2, "encoded":[B
    :cond_d6
    new-instance v8, Ljava/security/InvalidKeyException;

    new-instance v9, Ljava/lang/StringBuilder;

    invoke-direct {v9}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v10, "Unsupported key type: "

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {p1}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/Class;->getName()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v9

    invoke-direct {v8, v9}, Ljava/security/InvalidKeyException;-><init>(Ljava/lang/String;)V

    throw v8

    .line 592
    .end local v2    # "encoded":[B
    .end local p1    # "key":Ljava/security/Key;
    :cond_f8
    :try_start_f8
    array-length v8, v2

    const/4 v9, 0x0

    invoke-virtual {p0, v2, v9, v8}, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->engineDoFinal([BII)[B
    :try_end_fd
    .catch Ljavax/crypto/BadPaddingException; {:try_start_f8 .. :try_end_fd} :catch_ff

    move-result-object v8

    return-object v8

    .line 593
    :catch_ff
    move-exception v1

    .line 594
    .local v1, "e":Ljavax/crypto/BadPaddingException;
    new-instance v8, Ljavax/crypto/IllegalBlockSizeException;

    invoke-direct {v8}, Ljavax/crypto/IllegalBlockSizeException;-><init>()V

    invoke-virtual {v8, v1}, Ljavax/crypto/IllegalBlockSizeException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;

    move-result-object v8

    check-cast v8, Ljavax/crypto/IllegalBlockSizeException;

    throw v8
.end method

.method public finalize()V
    .registers 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/Throwable;
        }
    .end annotation

    .prologue
    .line 678
    :try_start_0
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 679
    .local v0, "operationToken":Landroid/os/IBinder;
    if-eqz v0, :cond_9

    .line 680
    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    invoke-virtual {v1, v0}, Landroid/security/KeyStore;->abort(Landroid/os/IBinder;)I
    :try_end_9
    .catchall {:try_start_0 .. :try_end_9} :catchall_d

    .line 683
    :cond_9
    invoke-super {p0}, Ljavax/crypto/CipherSpi;->finalize()V

    .line 676
    return-void

    .line 682
    .end local v0    # "operationToken":Landroid/os/IBinder;
    :catchall_d
    move-exception v1

    .line 683
    invoke-super {p0}, Ljavax/crypto/CipherSpi;->finalize()V

    .line 682
    throw v1
.end method

.method protected abstract getAdditionalEntropyAmountForBegin()I
.end method

.method protected abstract getAdditionalEntropyAmountForFinish()I
.end method

.method protected final getConsumedInputSizeBytes()J
    .registers 3

    .prologue
    .line 721
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    if-nez v0, :cond_d

    .line 722
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string/jumbo v1, "Not initialized"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 724
    :cond_d
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    invoke-interface {v0}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->getConsumedInputSizeBytes()J

    move-result-wide v0

    return-wide v0
.end method

.method protected final getKeyStore()Landroid/security/KeyStore;
    .registers 2

    .prologue
    .line 717
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    return-object v0
.end method

.method protected final getKeymasterPurposeOverride()I
    .registers 2

    .prologue
    .line 704
    iget v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    return v0
.end method

.method public final getOperationHandle()J
    .registers 3

    .prologue
    .line 689
    iget-wide v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationHandle:J

    return-wide v0
.end method

.method protected final getProducedOutputSizeBytes()J
    .registers 3

    .prologue
    .line 728
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    if-nez v0, :cond_d

    .line 729
    new-instance v0, Ljava/lang/IllegalStateException;

    const-string/jumbo v1, "Not initialized"

    invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 731
    :cond_d
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    invoke-interface {v0}, Landroid/security/keystore/KeyStoreCryptoOperationStreamer;->getProducedOutputSizeBytes()J

    move-result-wide v0

    return-wide v0
.end method

.method protected abstract initAlgorithmSpecificParameters()V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;
        }
    .end annotation
.end method

.method protected abstract initAlgorithmSpecificParameters(Ljava/security/AlgorithmParameters;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidAlgorithmParameterException;
        }
    .end annotation
.end method

.method protected abstract initAlgorithmSpecificParameters(Ljava/security/spec/AlgorithmParameterSpec;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidAlgorithmParameterException;
        }
    .end annotation
.end method

.method protected abstract initKey(ILjava/security/Key;)V
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/security/InvalidKeyException;
        }
    .end annotation
.end method

.method protected final isEncrypting()Z
    .registers 2

    .prologue
    .line 712
    iget-boolean v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mEncrypting:Z

    return v0
.end method

.method protected abstract loadAlgorithmSpecificParametersFromBeginResult(Landroid/security/keymaster/KeymasterArguments;)V
.end method

.method protected resetAll()V
    .registers 7

    .prologue
    const/4 v5, 0x0

    const/4 v4, 0x0

    .line 185
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 186
    .local v0, "operationToken":Landroid/os/IBinder;
    if-eqz v0, :cond_b

    .line 187
    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    invoke-virtual {v1, v0}, Landroid/security/KeyStore;->abort(Landroid/os/IBinder;)I

    .line 189
    :cond_b
    iput-boolean v5, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mEncrypting:Z

    .line 190
    const/4 v1, -0x1

    iput v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    .line 191
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    .line 192
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mRng:Ljava/security/SecureRandom;

    .line 193
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 194
    const-wide/16 v2, 0x0

    iput-wide v2, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationHandle:J

    .line 195
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 196
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 197
    iput-boolean v5, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    .line 198
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 184
    return-void
.end method

.method protected resetWhilePreservingInitState()V
    .registers 6

    .prologue
    const/4 v4, 0x0

    .line 211
    iget-object v0, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 212
    .local v0, "operationToken":Landroid/os/IBinder;
    if-eqz v0, :cond_a

    .line 213
    iget-object v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeyStore:Landroid/security/KeyStore;

    invoke-virtual {v1, v0}, Landroid/security/KeyStore;->abort(Landroid/os/IBinder;)I

    .line 215
    :cond_a
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationToken:Landroid/os/IBinder;

    .line 216
    const-wide/16 v2, 0x0

    iput-wide v2, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mOperationHandle:J

    .line 217
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mMainDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 218
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamer:Landroid/security/keystore/KeyStoreCryptoOperationStreamer;

    .line 219
    const/4 v1, 0x0

    iput-boolean v1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mAdditionalAuthenticationDataStreamerClosed:Z

    .line 220
    iput-object v4, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mCachedException:Ljava/lang/Exception;

    .line 210
    return-void
.end method

.method protected final setKey(Landroid/security/keystore/AndroidKeyStoreKey;)V
    .registers 2
    .param p1, "key"    # Landroid/security/keystore/AndroidKeyStoreKey;

    .prologue
    .line 693
    iput-object p1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKey:Landroid/security/keystore/AndroidKeyStoreKey;

    .line 692
    return-void
.end method

.method protected final setKeymasterPurposeOverride(I)V
    .registers 2
    .param p1, "keymasterPurpose"    # I

    .prologue
    .line 700
    iput p1, p0, Landroid/security/keystore/AndroidKeyStoreCipherSpiBase;->mKeymasterPurposeOverride:I

    .line 699
    return-void
.end method

redpajama_set_name: RedPajamaGithub


text:
Q: How can I make a bouncing label in WPF xaml? (C#) I'm stuck with my school assignment and it should be ready soon, so I hope someone could help me. I've been searching for a solution for hours. I'm sure this is a very simple thing, but I just can't figure it out.
So I'm trying to make a label move in a specific area so that it bounces from "borders" (an area defined with From/To) and takes a new direction. So far I have only managed to make it move up and down, left and right or from corner to corner, but not in every direction. I have no idea how I'm supposed to implement this. This is my xaml code:
    <Canvas Height="60" HorizontalAlignment="Left" Margin="138,0,0,0" Name="canvas1" VerticalAlignment="Top" Width="227">
        <Label Content="GKO" Height="40" Name="labelGKO" Canvas.Left="19" Canvas.Top="6" Width="61" FontSize="8">
            <Label.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                    <BeginStoryboard>
                        <Storyboard TargetName="labelGKO" RepeatBehavior="Forever">
                            <DoubleAnimation
                                Storyboard.TargetProperty="(Canvas.Left)"
                                From="0"  To="180" Duration="0:0:1"/>
                            <DoubleAnimation
                                Storyboard.TargetProperty="(Canvas.Top)"
                                From="0" To="50" Duration="0:0:1"
                                AutoReverse="True" />
                            <DoubleAnimation
                                Storyboard.TargetProperty="(Label.FontSize)"
                                To="24" Duration="0:0:1"
                                AutoReverse="True" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Label.Triggers>
        </Label>
    </Canvas>

This makes the label move from up left corner to the bottom right and then up. Then it starts from the beginning. It is clear I don't understand the logic behind it. Should I do multiple Storyboards or DoubleAnimations? Or can I somehow change the course of the label during one animation? How can I tell the label where exactly to go after it has reached a border?

redpajama_set_name: RedPajamaStackExchange


text:
Enriching the Tradition… the "Ramanujan" Way!
Salil Sawarkar December 22, 2019
It was somewhere around 1912-1913, more than hundred years back from now, when Prof. G. H. Hardy, one of the most popular and prolific mathematicians of that time, had received a letter. It was from India, far away from Great Britain! Hardy must have had tough time in pronouncing the name of the sender. The sender had requested Hardy to go through his mathematical work. When people get name and fame in their field, they receive several such letters from various parts of the world, most of which are completely worthless! Hardy too was used to such letters and was in no mood to go through the, so called, 'mathematical work', of a poor person from a poor country.
To add to it, the sender had clearly stated that he had finished only matriculation, by then. However, something in the letter, may be the courteous and yet confident language of the sender stopped him from throwing the mail to dustbin, and during night time, he decided to go through it thoroughly. Ignoring the introductory lines, he went straight ahead to the accompanying mathematical results and within a few seconds, found himself sitting upright, completely focused on the contents, and having forgotten the surroundings!
He thought over it again and again. Some of the results, mentioned in the letter, seemed to be known to him, a few he could prove, but the remaining completely baffled him. It was hard, even for the stalwart like Hardy, to believe that such results could exist, and yet, it was almost clear that no non-mathematician could ever dream such results, let alone write! He realized that he was going through a monumental work in mathematics. He further realized that the sender of the letter, Mr. Shrinivasa Ramanujan, should be brought to England. And then, because of his incessant efforts, Ramanujan went to England and stayed there for almost six years. It was this stay that could bring his work in limelight. It was this stay that earned him the name, which he deserved. It was this stay that made the world come to know about this genius mathematician and his work!
A story of Hardy and Ramanujan is very popular. Once, Hardy came to meet Ramanujan by a cab. Being always curious, he read the number plate and was a bit unhappy after seeing that the number was 1729. He couldn't think of any nice mathematical property of the number. Moreover, the number was divisible by 13! After some talk with Ramanujan, Hardy mentioned about 1729. However, the moment he said that there seemed to be no nice property associated with it, Ramanujan immediately responded, as if pleading the number, "Sir, it's an interesting number, for it is the smallest one, which can be expressed as the sum of cubes of two positive integers, in two different manners: 123 + 13 and 103 + 93 ". Hardy could hardly believe what he listened. A great number theorist, he was, and yet he wasn't aware of such interesting property of 1729. It is said that, Hardy told this story to everyone whomsoever he met on his returning journey.
What makes Ramanujan special person? Of course, his immense affection towards the subject (mathematics) and almost complete ignorance towards anything else certainly marks him a devotee of the goddess, called mathematics. But more important was the fact that he was devoid of even the basic things that are needed to be a genius! He had absolutely no money to buy even the papers, forget about the books; and his total focus on mathematics made him a failure in the first year of college and thus he was devoid of the higher education also. What he learned was very less, and yet, what he created was stupendous!
The poverty that encircled him was so stern that he had to wander through the streets, in search of pieces of paper, to write something on. The citizens who used to throw paper wrappers carelessly, hither and tither, were actually providing him the required material. And even then his brain was so fast and generating newer and newer results, that even this wasn't sufficient. So he had to use inks of different colour to write different results on the same paper. In fact, he could write only the results; writing the proofs was beyond the available raw material. Almost all the proofs were there in his brain, stored safely.
Ramanujan worked mainly in the areas like analysis, number theory, infinite series and continued fraction. He was so ahead of the time that he could provide solutions to many problems, which were regarded as unsolvable, then. His independent contribution to the field of mathematics is enormous. He could develop around as many as 4000 results. Ramanujan prime, Ramanujan theta function, mock theta function form some of his popular works. These have been instrumental in developing new areas of mathematics. After experiencing his extensive ability to work, hours after hours, and generating new results, every now and then, Hardy aptly remarked that he could be only compared with Euler!
Ramanujan's work created not only a wave of happiness in the community of mathematicians, it also created a feeling of surprise and amazement amongst them. By the beginning of twentieth century, the whole world was under a belief, in fact a misbelief that it's only Europe, which has "fertile" land and so only Europe can germinate brilliant brains! This belief was not only far from the truth, it was, in fact, a mendacity! It was India and Indians, who had given the great gift of decimal system to the entire world. When the so called 'fertile' Europe was struggling in carrying out simple multiplication, because of the unwieldy system of the Roman numerals, the Indians had gone far ahead in all sorts of computations! It's interesting to note that we had coined terms for the numbers from 101 to about 1050 !!
It's because of the merchants, who used to trade with Indians as well as with the westerns, that the Europe understood the decimal system, and thanks to heaven, that they realized the importance of the same. The merchants (mainly Arabians) used to travel from western countries to Asian countries. At every place, they had to do lot of calculations, almost everything in mind. They were the first from outside India, who realized the power of decimal system. They then made it popular all over the world. It's sad that the digits, like, 1, 2, 3, etc. are called Arabian numerals. They should be called Indian numerals, if not Hindu numerals.
The famous fact about any right angled triangle, that the sum of the squares of its two perpendicular sides equals the square of its hypotenuse, too was known to Indians. As we go through the scriptures, especially the ones, which describe the processes involved in sacrifices (Yajna), we realize this fact. And still, this is known only as Pythagoras theorem! To add some sorrows to this sad story, hardly any Indian feels sorry for this! It is said about Pythagoras that he had been to India, once upon a time. We have no intention to say that he just borrowed this theorem from us! He might have developed the same, on his own. But then, if he had been to India, he might have learned several other aspects of mathematics, which might have helped him develop this result!
Sir Isaac Newton is certainly a great name in the field of science and mathematics, because of his invaluable contribution to both these subjects! Calculus is a celebrated branch of mathematics and Newton enjoys the fame of being "the father" of Calculus, along with Leibnitz! Undoubtedly, the contribution of these two contemporary geniuses is praiseworthy!
However, is it really true that before these two, no one had any idea of the basics of Calculus? In India, there were several attempts to find the value of π. Mathematicians like Aryabhatta (5 th Century A.D.) has stated the value of π, correct up to 5 to 6 decimal places! This π fellow is very much essential in getting the area of a circle. The formula πr2 is certainly known to everyone! But note that, this formula is not just an accepted one, like area of rectangle! This means, by assuming that the area of a rectangle equals length multiplied by breadth, one can "prove" that the area of a circle is πr2. But to prove this, one needs integration. Integration depends upon the concept of limit, which is the basis of Calculus. So unless we had some idea of limit, how would we have thought of area of circle and why else would we have stumbled upon this celebrated π? Of course, these are surmises, but still, are worth pondering!
Another interesting story is about Madhava, a mathematician from South India, who died much before Newton was born! Any matriculate knows the basics of trigonometry and some particular values, like sin 30o = ½ and so on! It should be noted that by using the basic results in Pure Geometry, one can prove this! Let us not have a wrong feeling that by "measuring" the various lengths of sides of a right angled triangle, one may get all these values. In fact, the whole Geometry is far from measuring lengths and angles. It's actually analysis that we do!
But then the next question that a curious mind would ask is, what is sin 29o? Of course, your calculator would give you approximate answer, but how does it know even the approximate answer? We have properties of 30-60-90 triangle; do we have properties of a 29-61-90 triangle? If not, how could we get sin 29o, or cos 61o, etc.? But using the techniques of Calculus, mathematicians have developed what they call "infinite series", which can be employed to get answers to such questions to any desirable level of accuracy.
The series for the functions like sin, cos and many others are so bizarre, that it's almost impossible for anyone to come up with these, just by chance, without using Calculus. And now here comes the most interesting and worth thinking part of the story. Madhava knew these series. He has explicitly mentioned these in his work. His methods might have been different, but unless the basics of Calculus were employed, how on earth, he (or any of his teachers) could write those series? What we have seen above are only some of the glimpses of the glorious past of Indian mathematicians.
We had a great tradition in the field of science and mathematics. Ramanujan was basically an adherent of these traditions; but through his indisputable intellect and exhaustive hard work he was able to enrich the same, considerably!!!
Salil Sawarkar
Salil Sawarkar holds a post-graduate degree in mathematics and works as an assistant professor in mathematics at CHM college, Ulhasnagar. Being a passionate mathematician, SalilRead more
A Ganesha Visarjan Procession In Mysore
Sreejit Datta
Rediscovering Rama : Part – I
Aditi Banerjee
Sarasvati: Beyond The Iconographic Symbolism
Rekha Rao
Indian Mathematics
MAths Day
Mathematics in India
Ancient Mathematical Treasures – Part VIII
Ancient Indian Mathematical Treasures – Part VII

redpajama_set_name: RedPajamaCommonCrawl


Times have changed and the methods of auction have evolved! At IAM Sold, we offer both traditional and modern methods with flexible routes for sellers looking to sell quickly, heighten interest in their property and/or add security to the process that the open market may not be able to offer.
Buying property at auction is not just for the experienced investor looking for their next renovation project. It is now often the preferred route for those looking for their ideal property due to the accessibility and benefits that the process offers, namely the speed and security.
To find out more about our auction service please click here to visit our dedicated website, alternatively speak to your nearest regional office.


Bay Bucks Coupons are the premier saving option for a trip to Put-in-Bay. Inside the booklet, there are many island discounts. The total value is hundreds of dollars. Participating businesses represent both Put-in-Bay and Middle Bass Island. There are over 60 businesses participating in the booklet. So, there is a considerable amount of savings. Savings for such great attractions as Put-in-Bay Para Sail or Kayak the Bay.
A day trip to Put-in-Bay involves a few steps. First, drive to one of the ferry terminal. The Miller Ferry offers passenger and vehicle service from Catawba Island. The Jet Express offers passenger service from Port Clinton. Then, set sail for South Bass Island. Once on the island, there is a host of shops, restaurants and attractions. The Bay Bucks Coupons will help in all of these aspects. There are discounts for some of Put-in-Bay's best stores and the most fun things to do. So, a trip to the island is not complete without Bay Bucks. Grab yours today and realize the benefits.
Additionally, there are discounts for lodging on the island in the Bay Bucks Coupon book. Staying over on Put-in-Bay is the preferred way to experience it all. Waking up on the island will put everything in perspective. There truly is an aura about Put in bay. A feeling of happiness and joy seems to permeate the ground. Therefore, don't hesitate to plan a trip to the island. Whether a day trip or an overnight stay, it will be a trip that won't be forgotten. Put-in-Bay truly is a very remarkable place. One worth including on a bucket list.
Lastly, proper planning will ensure a trip to Put-in-Bay is a resounding success. Incorporating the benefits of Bay Bucks will be a great way to get the most for the money. See you at the bay… Put-in-Bay Ohio!


text:
Name a more iconic duo — watch Patti Smith and Bruce Springsteen's reunion
Posted By Jerilyn Jordan on Tue, Apr 24, 2018 at 10:28 AM
Photo via Twitter, @BeaconTheatre
Former metro Detroiter and godmother of punk, poetry and prose Patti Smith reunited briefly Monday night with musical cohort Bruce Springsteen. The occasion? The Tribeca Film Festival premiere of Smith's concert film Horses: Patti Smith and Her Band. Directed by Steven Sebring, the film documents one of the final performances of the poet's seminal album Horses which was performed in its entirety at the Wiltern Theatre in Los Angeles for the record's fortieth anniversary in 2015.
Smith, who played a short six-song set after the film, was joined by "The Boss" for a performance of "Because the Night" — a song written by Springsteen and made popular by Smith in 1978.
To close out the set, Smith invited daughter Jesse Paris Smith and R.E.M frontman Michael Stipe for "People Have the Power" from 1988's Dream of Life.
Though Smith was born in Chicago and grew up in New Jersey, the now 71-year-old married Michigan native Fred "Sonic" Smith of the MC5 in the 70s and moved with him to St. Clair Shores where they lived until Fred's death in 1994.
Watch the trailer for Horses: Patti Smith and Her Band below:
Tags: Patti Smith, Bruce Springsteen, Michael Stipe, Horses, Because the night, MC5, Fred Sonic Smith, Detroit music, Punk rock, Detroit punk, Image
« Judas Priest and Deep Purple will s… | Stunning glassworks to be featured… »
More City Slang »
Pine Knob is back
Loss won't keep Patti Smith from loving
by Jerilyn Jordan
Celebrate Valentine's Day with Patti Smith in a totally Patti Smith way
Spend Valentine's Day with Patti Smith and her new book 'Devotion'
Patti Smith forgot lyrics during a Sam Shepard tribute and it's totally precious
Fans react to news that veteran Detroit radio DJ John O'Leary was found stabbed to death at Highland Park home
Detroit rock 'n' roll photographer Leni Sinclair and late poster artist Gary Grimshaw honored with dual exhibition in Royal Oak
British rock band IDLES heads to Detroit's St. Andrew's Hall ahead of new record
More on City Slang
Motown legend Martha Reeves to perform benefit concert for victims of Oxford shooting
Don't freak — the Aces will bring their upbeat shopping montage pop to St. Andrew's Hall in Detroit
Detroit's Chloe Moriondo will bring the 'Blood Bunny' for headlining homecoming performance at El Club
More by Jerilyn Jordan
How magic mushrooms could become Michigan's next frontier — and why it matters
You can catch sax sensation Kenny G at Detroit's MotorCity Casino Hotel
Please shut up and watch the timeless classic 'It's A Wonderful Life' at Detroit's Redford Theatre
Detroit area venues and promoters need you to tell Congress to #SaveOurStages
The new 'Creem' doc is out today, here's how you can watch it
Dear Amazon, before you bulldoze more than 80 years of Detroit music history, please read this
Ann Arbor Folk Festival canceled due to COVID-19 surge Read More
Pine Knob is back Read More
Detroit's Fire and Ice fest will have techno dance party, ice sculptures, and bonfires Read More
Motown Founder Berry Gordy celebrated with Kennedy Center Honors Read More
Lakepointe Yacht Club Read More
Cherry Blossom Read More
Shelley's Chicken Manor Read More


text:
require 'misty/http/net_http'
module Misty
  module Auth
    module Token
      include Misty::HTTP::NetHTTP
      attr_reader :catalog, :expires, :token, :user, :data

      def self.build(auth)
        if auth[:tenant_id] || auth[:tenant]
          Misty::Auth::Token::V2.new(auth)
        else
          Misty::Auth::Token::V3.new(auth)
        end
      end

      def initialize(auth)
        @log = auth[:log]

        if auth[:context] && auth[:context][:token] && auth[:context][:expires] && auth[:context][:catalog]
          # Bypass authentication
          @catalog = Misty::Auth::Catalog.new(auth[:context][:catalog])
          @expires = auth[:context][:expires]
          @token = auth[:context][:token]
        else
          raise URLError, 'No URL provided' if auth[:url].nil? || auth[:url].empty?
          @creds = {
            :data            => set_credentials(auth),
            :ssl_verify_mode => auth[:ssl_verify_mode].nil? ? Misty::Config::SSL_VERIFY_MODE : auth[:ssl_verify_mode],
            :uri             => URI.parse(auth[:url])
          }
          set(authenticate(@creds))
        end
      end

      def get
        set(authenticate(@creds)) if expired?
        @token
      end

      private

      def authenticate(creds)
        Misty::HTTP::NetHTTP.http_request(
          creds[:uri], ssl_verify_mode: creds[:ssl_verify_mode], log: @log
        ) do |connection|
          connect_path = creds[:uri].path + path
          response = connection.post(connect_path, creds[:data].to_json,
            { 'Content-Type' => 'application/json', 'Accept' => 'application/json' })
          unless response.code =~ /200|201/
            raise AuthenticationError, "Response code=#{response.code}, Msg=#{response.msg}"
          end
          response
        end
      end

      def expired?
        if @expires.nil? || @expires.empty?
          raise ExpiryError, 'Missing token expiration data'
        end
        Time.parse(@expires) < Time.now.utc
      end

      def refresh
        raise StandardError, "__method__ not implemented yet!"
      end
    end
  end
end


Blank signature strip cards offer a level of advanced security and increase the effectiveness of photo ID verification.
Made from a PVC material they feature a signature panel. All of the cards within our range are compatible with both full colour and monochrome plastic card printers.