diff --git a/System/X509/Win32.hs b/System/X509/Win32.hs
--- a/System/X509/Win32.hs
+++ b/System/X509/Win32.hs
@@ -36,15 +36,17 @@
 
 certFromContext :: PCCERT_Context -> IO (Either String SignedCertificate)
 certFromContext cctx = do
-    ty <- peek (castPtr cctx :: Ptr DWORD)
-    p  <- peek (castPtr (cctx `plusPtr` 4) :: Ptr (Ptr BYTE))
-    len <- peek (castPtr (cctx `plusPtr` 8) :: Ptr DWORD)
+    ty  <- peek (castPtr cctx :: Ptr DWORD)
+    p   <- peek (castPtr (cctx `plusPtr` pbCertEncodedPos) :: Ptr (Ptr BYTE))
+    len <- peek (castPtr (cctx `plusPtr` cbCertEncodedPos) :: Ptr DWORD)
     process ty p len
   where process 1 p len = do
             b <- B.create (fromIntegral len) $ \dst -> B.memcpy dst p (fromIntegral len)
             return $ decodeSignedObject b
         process ty _ _ =
             return $ Left ("windows certificate store: not supported type: " ++ show ty)
+        pbCertEncodedPos = alignment (undefined :: Ptr (Ptr Bytes))
+        cbCertEncoded    = pbCertEncodedPos + sizeOf (undefined :: Ptr (Ptr Bytes))
 
 getSystemCertificateStore :: IO CertificateStore
 getSystemCertificateStore = do
diff --git a/x509-system.cabal b/x509-system.cabal
--- a/x509-system.cabal
+++ b/x509-system.cabal
@@ -1,5 +1,5 @@
 Name:                x509-system
-Version:             1.4.2
+Version:             1.4.3
 Description:         System X.509 handling
 License:             BSD3
 License-file:        LICENSE
