#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gio.Objects.TlsCertificate
(
TlsCertificate(..) ,
IsTlsCertificate ,
toTlsCertificate ,
noTlsCertificate ,
#if ENABLE_OVERLOADING
TlsCertificateGetIssuerMethodInfo ,
#endif
tlsCertificateGetIssuer ,
#if ENABLE_OVERLOADING
TlsCertificateIsSameMethodInfo ,
#endif
tlsCertificateIsSame ,
tlsCertificateListNewFromFile ,
tlsCertificateNewFromFile ,
tlsCertificateNewFromFiles ,
tlsCertificateNewFromPem ,
#if ENABLE_OVERLOADING
TlsCertificateVerifyMethodInfo ,
#endif
tlsCertificateVerify ,
#if ENABLE_OVERLOADING
TlsCertificateCertificatePropertyInfo ,
#endif
constructTlsCertificateCertificate ,
getTlsCertificateCertificate ,
#if ENABLE_OVERLOADING
tlsCertificateCertificate ,
#endif
#if ENABLE_OVERLOADING
TlsCertificateCertificatePemPropertyInfo,
#endif
constructTlsCertificateCertificatePem ,
getTlsCertificateCertificatePem ,
#if ENABLE_OVERLOADING
tlsCertificateCertificatePem ,
#endif
#if ENABLE_OVERLOADING
TlsCertificateIssuerPropertyInfo ,
#endif
constructTlsCertificateIssuer ,
getTlsCertificateIssuer ,
#if ENABLE_OVERLOADING
tlsCertificateIssuer ,
#endif
#if ENABLE_OVERLOADING
TlsCertificatePrivateKeyPropertyInfo ,
#endif
constructTlsCertificatePrivateKey ,
#if ENABLE_OVERLOADING
tlsCertificatePrivateKey ,
#endif
#if ENABLE_OVERLOADING
TlsCertificatePrivateKeyPemPropertyInfo ,
#endif
constructTlsCertificatePrivateKeyPem ,
#if ENABLE_OVERLOADING
tlsCertificatePrivateKeyPem ,
#endif
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Flags as Gio.Flags
import {-# SOURCE #-} qualified GI.Gio.Interfaces.SocketConnectable as Gio.SocketConnectable
newtype TlsCertificate = TlsCertificate (ManagedPtr TlsCertificate)
foreign import ccall "g_tls_certificate_get_type"
c_g_tls_certificate_get_type :: IO GType
instance GObject TlsCertificate where
gobjectType = c_g_tls_certificate_get_type
class (GObject o, O.IsDescendantOf TlsCertificate o) => IsTlsCertificate o
instance (GObject o, O.IsDescendantOf TlsCertificate o) => IsTlsCertificate o
instance O.HasParentTypes TlsCertificate
type instance O.ParentTypes TlsCertificate = '[GObject.Object.Object]
toTlsCertificate :: (MonadIO m, IsTlsCertificate o) => o -> m TlsCertificate
toTlsCertificate = liftIO . unsafeCastTo TlsCertificate
noTlsCertificate :: Maybe TlsCertificate
noTlsCertificate = Nothing
#if ENABLE_OVERLOADING
type family ResolveTlsCertificateMethod (t :: Symbol) (o :: *) :: * where
ResolveTlsCertificateMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveTlsCertificateMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveTlsCertificateMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveTlsCertificateMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveTlsCertificateMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveTlsCertificateMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveTlsCertificateMethod "isSame" o = TlsCertificateIsSameMethodInfo
ResolveTlsCertificateMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveTlsCertificateMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveTlsCertificateMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveTlsCertificateMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveTlsCertificateMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveTlsCertificateMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveTlsCertificateMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveTlsCertificateMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveTlsCertificateMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveTlsCertificateMethod "verify" o = TlsCertificateVerifyMethodInfo
ResolveTlsCertificateMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveTlsCertificateMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveTlsCertificateMethod "getIssuer" o = TlsCertificateGetIssuerMethodInfo
ResolveTlsCertificateMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveTlsCertificateMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveTlsCertificateMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveTlsCertificateMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveTlsCertificateMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveTlsCertificateMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTlsCertificateMethod t TlsCertificate, O.MethodInfo info TlsCertificate p) => OL.IsLabel t (TlsCertificate -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
getTlsCertificateCertificate :: (MonadIO m, IsTlsCertificate o) => o -> m (Maybe ByteString)
getTlsCertificateCertificate obj = liftIO $ B.Properties.getObjectPropertyByteArray obj "certificate"
constructTlsCertificateCertificate :: (IsTlsCertificate o) => ByteString -> IO (GValueConstruct o)
constructTlsCertificateCertificate val = B.Properties.constructObjectPropertyByteArray "certificate" (Just val)
#if ENABLE_OVERLOADING
data TlsCertificateCertificatePropertyInfo
instance AttrInfo TlsCertificateCertificatePropertyInfo where
type AttrAllowedOps TlsCertificateCertificatePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TlsCertificateCertificatePropertyInfo = (~) ByteString
type AttrBaseTypeConstraint TlsCertificateCertificatePropertyInfo = IsTlsCertificate
type AttrGetType TlsCertificateCertificatePropertyInfo = (Maybe ByteString)
type AttrLabel TlsCertificateCertificatePropertyInfo = "certificate"
type AttrOrigin TlsCertificateCertificatePropertyInfo = TlsCertificate
attrGet _ = getTlsCertificateCertificate
attrSet _ = undefined
attrConstruct _ = constructTlsCertificateCertificate
attrClear _ = undefined
#endif
getTlsCertificateCertificatePem :: (MonadIO m, IsTlsCertificate o) => o -> m (Maybe T.Text)
getTlsCertificateCertificatePem obj = liftIO $ B.Properties.getObjectPropertyString obj "certificate-pem"
constructTlsCertificateCertificatePem :: (IsTlsCertificate o) => T.Text -> IO (GValueConstruct o)
constructTlsCertificateCertificatePem val = B.Properties.constructObjectPropertyString "certificate-pem" (Just val)
#if ENABLE_OVERLOADING
data TlsCertificateCertificatePemPropertyInfo
instance AttrInfo TlsCertificateCertificatePemPropertyInfo where
type AttrAllowedOps TlsCertificateCertificatePemPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TlsCertificateCertificatePemPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint TlsCertificateCertificatePemPropertyInfo = IsTlsCertificate
type AttrGetType TlsCertificateCertificatePemPropertyInfo = (Maybe T.Text)
type AttrLabel TlsCertificateCertificatePemPropertyInfo = "certificate-pem"
type AttrOrigin TlsCertificateCertificatePemPropertyInfo = TlsCertificate
attrGet _ = getTlsCertificateCertificatePem
attrSet _ = undefined
attrConstruct _ = constructTlsCertificateCertificatePem
attrClear _ = undefined
#endif
getTlsCertificateIssuer :: (MonadIO m, IsTlsCertificate o) => o -> m TlsCertificate
getTlsCertificateIssuer obj = liftIO $ checkUnexpectedNothing "getTlsCertificateIssuer" $ B.Properties.getObjectPropertyObject obj "issuer" TlsCertificate
constructTlsCertificateIssuer :: (IsTlsCertificate o, IsTlsCertificate a) => a -> IO (GValueConstruct o)
constructTlsCertificateIssuer val = B.Properties.constructObjectPropertyObject "issuer" (Just val)
#if ENABLE_OVERLOADING
data TlsCertificateIssuerPropertyInfo
instance AttrInfo TlsCertificateIssuerPropertyInfo where
type AttrAllowedOps TlsCertificateIssuerPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint TlsCertificateIssuerPropertyInfo = IsTlsCertificate
type AttrBaseTypeConstraint TlsCertificateIssuerPropertyInfo = IsTlsCertificate
type AttrGetType TlsCertificateIssuerPropertyInfo = TlsCertificate
type AttrLabel TlsCertificateIssuerPropertyInfo = "issuer"
type AttrOrigin TlsCertificateIssuerPropertyInfo = TlsCertificate
attrGet _ = getTlsCertificateIssuer
attrSet _ = undefined
attrConstruct _ = constructTlsCertificateIssuer
attrClear _ = undefined
#endif
constructTlsCertificatePrivateKey :: (IsTlsCertificate o) => ByteString -> IO (GValueConstruct o)
constructTlsCertificatePrivateKey val = B.Properties.constructObjectPropertyByteArray "private-key" (Just val)
#if ENABLE_OVERLOADING
data TlsCertificatePrivateKeyPropertyInfo
instance AttrInfo TlsCertificatePrivateKeyPropertyInfo where
type AttrAllowedOps TlsCertificatePrivateKeyPropertyInfo = '[ 'AttrConstruct, 'AttrClear]
type AttrSetTypeConstraint TlsCertificatePrivateKeyPropertyInfo = (~) ByteString
type AttrBaseTypeConstraint TlsCertificatePrivateKeyPropertyInfo = IsTlsCertificate
type AttrGetType TlsCertificatePrivateKeyPropertyInfo = ()
type AttrLabel TlsCertificatePrivateKeyPropertyInfo = "private-key"
type AttrOrigin TlsCertificatePrivateKeyPropertyInfo = TlsCertificate
attrGet _ = undefined
attrSet _ = undefined
attrConstruct _ = constructTlsCertificatePrivateKey
attrClear _ = undefined
#endif
constructTlsCertificatePrivateKeyPem :: (IsTlsCertificate o) => T.Text -> IO (GValueConstruct o)
constructTlsCertificatePrivateKeyPem val = B.Properties.constructObjectPropertyString "private-key-pem" (Just val)
#if ENABLE_OVERLOADING
data TlsCertificatePrivateKeyPemPropertyInfo
instance AttrInfo TlsCertificatePrivateKeyPemPropertyInfo where
type AttrAllowedOps TlsCertificatePrivateKeyPemPropertyInfo = '[ 'AttrConstruct, 'AttrClear]
type AttrSetTypeConstraint TlsCertificatePrivateKeyPemPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint TlsCertificatePrivateKeyPemPropertyInfo = IsTlsCertificate
type AttrGetType TlsCertificatePrivateKeyPemPropertyInfo = ()
type AttrLabel TlsCertificatePrivateKeyPemPropertyInfo = "private-key-pem"
type AttrOrigin TlsCertificatePrivateKeyPemPropertyInfo = TlsCertificate
attrGet _ = undefined
attrSet _ = undefined
attrConstruct _ = constructTlsCertificatePrivateKeyPem
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList TlsCertificate
type instance O.AttributeList TlsCertificate = TlsCertificateAttributeList
type TlsCertificateAttributeList = ('[ '("certificate", TlsCertificateCertificatePropertyInfo), '("certificatePem", TlsCertificateCertificatePemPropertyInfo), '("issuer", TlsCertificateIssuerPropertyInfo), '("privateKey", TlsCertificatePrivateKeyPropertyInfo), '("privateKeyPem", TlsCertificatePrivateKeyPemPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
tlsCertificateCertificate :: AttrLabelProxy "certificate"
tlsCertificateCertificate = AttrLabelProxy
tlsCertificateCertificatePem :: AttrLabelProxy "certificatePem"
tlsCertificateCertificatePem = AttrLabelProxy
tlsCertificateIssuer :: AttrLabelProxy "issuer"
tlsCertificateIssuer = AttrLabelProxy
tlsCertificatePrivateKey :: AttrLabelProxy "privateKey"
tlsCertificatePrivateKey = AttrLabelProxy
tlsCertificatePrivateKeyPem :: AttrLabelProxy "privateKeyPem"
tlsCertificatePrivateKeyPem = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList TlsCertificate = TlsCertificateSignalList
type TlsCertificateSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "g_tls_certificate_new_from_file" g_tls_certificate_new_from_file ::
CString ->
Ptr (Ptr GError) ->
IO (Ptr TlsCertificate)
tlsCertificateNewFromFile ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m TlsCertificate
tlsCertificateNewFromFile file = liftIO $ do
file' <- stringToCString file
onException (do
result <- propagateGError $ g_tls_certificate_new_from_file file'
checkUnexpectedReturnNULL "tlsCertificateNewFromFile" result
result' <- (wrapObject TlsCertificate) result
freeMem file'
return result'
) (do
freeMem file'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_tls_certificate_new_from_files" g_tls_certificate_new_from_files ::
CString ->
CString ->
Ptr (Ptr GError) ->
IO (Ptr TlsCertificate)
tlsCertificateNewFromFiles ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> [Char]
-> m TlsCertificate
tlsCertificateNewFromFiles certFile keyFile = liftIO $ do
certFile' <- stringToCString certFile
keyFile' <- stringToCString keyFile
onException (do
result <- propagateGError $ g_tls_certificate_new_from_files certFile' keyFile'
checkUnexpectedReturnNULL "tlsCertificateNewFromFiles" result
result' <- (wrapObject TlsCertificate) result
freeMem certFile'
freeMem keyFile'
return result'
) (do
freeMem certFile'
freeMem keyFile'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_tls_certificate_new_from_pem" g_tls_certificate_new_from_pem ::
CString ->
Int64 ->
Ptr (Ptr GError) ->
IO (Ptr TlsCertificate)
tlsCertificateNewFromPem ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
-> Int64
-> m TlsCertificate
tlsCertificateNewFromPem data_ length_ = liftIO $ do
data_' <- textToCString data_
onException (do
result <- propagateGError $ g_tls_certificate_new_from_pem data_' length_
checkUnexpectedReturnNULL "tlsCertificateNewFromPem" result
result' <- (wrapObject TlsCertificate) result
freeMem data_'
return result'
) (do
freeMem data_'
)
#if ENABLE_OVERLOADING
#endif
foreign import ccall "g_tls_certificate_get_issuer" g_tls_certificate_get_issuer ::
Ptr TlsCertificate ->
IO (Ptr TlsCertificate)
tlsCertificateGetIssuer ::
(B.CallStack.HasCallStack, MonadIO m, IsTlsCertificate a) =>
a
-> m TlsCertificate
tlsCertificateGetIssuer cert = liftIO $ do
cert' <- unsafeManagedPtrCastPtr cert
result <- g_tls_certificate_get_issuer cert'
checkUnexpectedReturnNULL "tlsCertificateGetIssuer" result
result' <- (newObject TlsCertificate) result
touchManagedPtr cert
return result'
#if ENABLE_OVERLOADING
data TlsCertificateGetIssuerMethodInfo
instance (signature ~ (m TlsCertificate), MonadIO m, IsTlsCertificate a) => O.MethodInfo TlsCertificateGetIssuerMethodInfo a signature where
overloadedMethod _ = tlsCertificateGetIssuer
#endif
foreign import ccall "g_tls_certificate_is_same" g_tls_certificate_is_same ::
Ptr TlsCertificate ->
Ptr TlsCertificate ->
IO CInt
tlsCertificateIsSame ::
(B.CallStack.HasCallStack, MonadIO m, IsTlsCertificate a, IsTlsCertificate b) =>
a
-> b
-> m Bool
tlsCertificateIsSame certOne certTwo = liftIO $ do
certOne' <- unsafeManagedPtrCastPtr certOne
certTwo' <- unsafeManagedPtrCastPtr certTwo
result <- g_tls_certificate_is_same certOne' certTwo'
let result' = (/= 0) result
touchManagedPtr certOne
touchManagedPtr certTwo
return result'
#if ENABLE_OVERLOADING
data TlsCertificateIsSameMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsTlsCertificate a, IsTlsCertificate b) => O.MethodInfo TlsCertificateIsSameMethodInfo a signature where
overloadedMethod _ = tlsCertificateIsSame
#endif
foreign import ccall "g_tls_certificate_verify" g_tls_certificate_verify ::
Ptr TlsCertificate ->
Ptr Gio.SocketConnectable.SocketConnectable ->
Ptr TlsCertificate ->
IO CUInt
tlsCertificateVerify ::
(B.CallStack.HasCallStack, MonadIO m, IsTlsCertificate a, Gio.SocketConnectable.IsSocketConnectable b, IsTlsCertificate c) =>
a
-> Maybe (b)
-> Maybe (c)
-> m [Gio.Flags.TlsCertificateFlags]
tlsCertificateVerify cert identity trustedCa = liftIO $ do
cert' <- unsafeManagedPtrCastPtr cert
maybeIdentity <- case identity of
Nothing -> return nullPtr
Just jIdentity -> do
jIdentity' <- unsafeManagedPtrCastPtr jIdentity
return jIdentity'
maybeTrustedCa <- case trustedCa of
Nothing -> return nullPtr
Just jTrustedCa -> do
jTrustedCa' <- unsafeManagedPtrCastPtr jTrustedCa
return jTrustedCa'
result <- g_tls_certificate_verify cert' maybeIdentity maybeTrustedCa
let result' = wordToGFlags result
touchManagedPtr cert
whenJust identity touchManagedPtr
whenJust trustedCa touchManagedPtr
return result'
#if ENABLE_OVERLOADING
data TlsCertificateVerifyMethodInfo
instance (signature ~ (Maybe (b) -> Maybe (c) -> m [Gio.Flags.TlsCertificateFlags]), MonadIO m, IsTlsCertificate a, Gio.SocketConnectable.IsSocketConnectable b, IsTlsCertificate c) => O.MethodInfo TlsCertificateVerifyMethodInfo a signature where
overloadedMethod _ = tlsCertificateVerify
#endif
foreign import ccall "g_tls_certificate_list_new_from_file" g_tls_certificate_list_new_from_file ::
CString ->
Ptr (Ptr GError) ->
IO (Ptr (GList (Ptr TlsCertificate)))
tlsCertificateListNewFromFile ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Char]
-> m [TlsCertificate]
tlsCertificateListNewFromFile file = liftIO $ do
file' <- stringToCString file
onException (do
result <- propagateGError $ g_tls_certificate_list_new_from_file file'
result' <- unpackGList result
result'' <- mapM (wrapObject TlsCertificate) result'
g_list_free result
freeMem file'
return result''
) (do
freeMem file'
)
#if ENABLE_OVERLOADING
#endif