Product SiteDocumentation Site

3.4.8. isEncrypted

The isEncrypted method can be used to find out if a given connection is encrypted. If successful it returns 1 for an encrypted connection and 0 for an unencrypted connection. If an error occurred, -1 will be returned. The following code demonstrates the use of isEncrypted:

Example 3.19. Using virConnectIsEncrypted

# Example-15.py
#!/usr/bin/env python3
import sys
import libvirt

conn = None
try:
    conn = libvirt.open("qemu:///system")
except libvirt.libvirtError as e:
    print(repr(e), file=sys.stderr)
    exit(1)

print('Connection is encrypted: '+str(conn.isEncrypted()))

conn.close()
exit(0)