Java 类org.bouncycastle.openpgp.PGPKeyFlags 实例源码

项目:jpgpj    文件:Subkey.java   
/**
 * Sets forSigning etc flags based on key data.
 */
protected void calculateUsage() throws PGPException {
    int flags = getUsageFlags();

    boolean canSign = (flags & PGPKeyFlags.CAN_SIGN) ==
        PGPKeyFlags.CAN_SIGN;
    boolean canEncrypt = ((flags & PGPKeyFlags.CAN_ENCRYPT_COMMS) ==
            PGPKeyFlags.CAN_ENCRYPT_COMMS) ||
        ((flags & PGPKeyFlags.CAN_ENCRYPT_STORAGE) ==
            PGPKeyFlags.CAN_ENCRYPT_STORAGE);

    forSigning = canSign &&
        secretKey != null && !secretKey.isPrivateKeyEmpty();
    forVerification = canSign;
    forEncryption = canEncrypt;
    forDecryption = canEncrypt &&
        secretKey != null && !secretKey.isPrivateKeyEmpty();
}
项目:desktopclient-java    文件:PGPUtils.java   
static boolean isSigningKey(PGPPublicKey key) {
    int keyFlags = getKeyFlags(key);
    return (keyFlags & PGPKeyFlags.CAN_SIGN) == PGPKeyFlags.CAN_SIGN;
}