'Ensure the resource is in its desired state.'

def check(self, module, perms_required=True):

    state_and_perms = super(PrivateKey, self).check(module, perms_required)
    def _check_size(privatekey):
        return (self.size == privatekey.bits())
    def _check_type(privatekey):
        return (self.type == privatekey.type())
    def _check_passphrase():
        try:
            crypto_utils.load_privatekey(self.path, self.passphrase)
            return True
        except crypto.Error:
            return False
    if ((not state_and_perms) or (not _check_passphrase())):
        return False
    privatekey = crypto_utils.load_privatekey(self.path, self.passphrase)
    return (_check_size(privatekey) and _check_type(privatekey))
