'Check if the private key can be loaded without specifying any passphrase.
PyCrypto >= 2.6.1 required in order to have the method importKey() in DSA class.
:param key_content_encoded: Encoded content of the private key to test
:param key_algorithm: Algorithm of the key (RSA or DSA)
:return: True only if the key can be successfuly loaded and is usable'

def is_private_key_unprotected(self, key_content_encoded, key_algorithm):

    state = False
    try:
        if (key_algorithm == 'RSA'):
            key = RSA.importKey(key_content_encoded)
        else:
            key = DSA.importKey(key_content_encoded)
        state = ((key is not None) and key.can_sign() and key.has_private())
    except Exception as e:
        print_debug('ERROR', ("Cannot    validate    key    protection    '%s'" % e))
        state = False
        pass
    return state
