Example usage for org.bouncycastle.openpgp PGPSecretKey getS2K

List of usage examples for org.bouncycastle.openpgp PGPSecretKey getS2K

Introduction

In this page you can find the example usage for org.bouncycastle.openpgp PGPSecretKey getS2K.

Prototype

public S2K getS2K() 

Source Link

Document

Return the S2K used to process this key

Usage

From source file:org.sufficientlysecure.keychain.pgp.PgpKeyOperation.java

License:Open Source License

static PGPSignatureGenerator getSignatureGenerator(PGPSecretKey secretKey, CryptoInputParcel cryptoInput) {

    S2K s2k = secretKey.getS2K();
    boolean isDivertToCard = s2k != null && s2k.getType() == S2K.GNU_DUMMY_S2K
            && s2k.getProtectionMode() == S2K.GNU_PROTECTION_MODE_DIVERT_TO_CARD;

    return getSignatureGenerator(secretKey.getPublicKey(), cryptoInput, isDivertToCard);
}

From source file:org.sufficientlysecure.keychain.pgp.PgpKeyOperation.java

License:Open Source License

private static boolean isDummy(PGPSecretKey secretKey) {
    S2K s2k = secretKey.getS2K();
    return s2k != null && s2k.getType() == S2K.GNU_DUMMY_S2K
            && s2k.getProtectionMode() != S2K.GNU_PROTECTION_MODE_DIVERT_TO_CARD;
}

From source file:org.sufficientlysecure.keychain.pgp.PgpKeyOperation.java

License:Open Source License

private static boolean isDivertToCard(PGPSecretKey secretKey) {
    S2K s2k = secretKey.getS2K();
    return s2k != null && s2k.getType() == S2K.GNU_DUMMY_S2K
            && s2k.getProtectionMode() == S2K.GNU_PROTECTION_MODE_DIVERT_TO_CARD;
}