aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java
blob: 71edcedd0550ee8ede77dcebb72e65dec9d9572d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.sufficientlysecure.keychain.ui;

import android.content.Intent;

import org.sufficientlysecure.keychain.nfc.NfcActivity;

public class EncryptActivity extends DrawerActivity {
    protected void startNfcSign(String pin, byte[] hashToSign, int hashAlgo) {
        Intent data = new Intent();

        // build PendingIntent for Yubikey NFC operations
        Intent intent = new Intent(this, NfcActivity.class);
        intent.setAction(NfcActivity.ACTION_SIGN_HASH);
        // pass params through to activity that it can be returned again later to repeat pgp operation
        intent.putExtra(NfcActivity.EXTRA_DATA, data);
        intent.putExtra(NfcActivity.EXTRA_PIN, pin);

        intent.putExtra(NfcActivity.EXTRA_NFC_HASH_TO_SIGN, hashToSign);
        intent.putExtra(NfcActivity.EXTRA_NFC_HASH_ALGO, hashAlgo);
        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

        startActivityForResult(intent, 0);
    }

    protected void startPassphraseDialog(long subkeyId) {
        Intent data = new Intent();

        // build PendingIntent for Yubikey NFC operations
        Intent intent = new Intent(this, PassphraseDialogActivity.class);
        // pass params through to activity that it can be returned again later to repeat pgp operation
        intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, subkeyId);

//        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);

        startActivityForResult(intent, 0);
    }
}