def detect_encrypted_resource(resource):
    """Detect if resource is encrypted with GnuPG

    Determining factors:
     a) The resource is ascii-armored text
     b) The resource is binary data starting with 0x8502"""
    try:
        line = resource.read(50)
        resource.seek(0)
    except AttributeError:
        line = resource[:50]
    if line.startswith(b'-----BEGIN PGP'):
        return True
    elif line.startswith(b'\x85\x02'):
        return True
    else:
        return False
