spotfire 2.4.2__tar.gz → 2.4.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. {spotfire-2.4.2/spotfire.egg-info → spotfire-2.4.3}/PKG-INFO +1 -1
  2. spotfire-2.4.3/spotfire/__init__.py +8 -0
  3. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile_helpers.h +9 -0
  4. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/codesign_windows.pyx +33 -21
  5. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/public.py +48 -0
  6. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/spk.py +10 -7
  7. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/test_sbdf.py +10 -7
  8. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/version.py +1 -1
  9. {spotfire-2.4.2 → spotfire-2.4.3/spotfire.egg-info}/PKG-INFO +1 -1
  10. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/valuearray.h +3 -0
  11. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/columnslice.c +10 -2
  12. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/internals.c +3 -3
  13. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/internals.h +1 -1
  14. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/object.c +26 -3
  15. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/tablemetadata.c +6 -2
  16. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/tableslice.c +46 -2
  17. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/valuearray.c +88 -5
  18. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/windows/__init__.pxd +9 -0
  19. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/windows/wincrypt.pxd +14 -1
  20. spotfire-2.4.2/spotfire/__init__.py +0 -7
  21. {spotfire-2.4.2 → spotfire-2.4.3}/CPPLINT.cfg +0 -0
  22. {spotfire-2.4.2 → spotfire-2.4.3}/LICENSE +0 -0
  23. {spotfire-2.4.2 → spotfire-2.4.3}/MANIFEST.in +0 -0
  24. {spotfire-2.4.2 → spotfire-2.4.3}/README.md +0 -0
  25. {spotfire-2.4.2 → spotfire-2.4.3}/pyproject.toml +0 -0
  26. {spotfire-2.4.2 → spotfire-2.4.3}/setup.cfg +0 -0
  27. {spotfire-2.4.2 → spotfire-2.4.3}/setup.py +0 -0
  28. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/_utils.py +0 -0
  29. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile.pyi +0 -0
  30. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile.pyx +0 -0
  31. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile_helpers.c +0 -0
  32. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile_helpers.pxi +0 -0
  33. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/cabfile_windows.pyx +0 -0
  34. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/codesign.pyi +0 -0
  35. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/codesign.pyx +0 -0
  36. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/data_function.py +0 -0
  37. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/sbdf.pyi +0 -0
  38. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/sbdf.pyx +0 -0
  39. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/sbdf_helpers.c +0 -0
  40. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/sbdf_helpers.h +0 -0
  41. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/sbdf_helpers.pxi +0 -0
  42. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/support.py +0 -0
  43. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/__init__.py +0 -0
  44. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/__main__.py +0 -0
  45. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/test_cabfile.py +0 -0
  46. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/test_data_function.py +0 -0
  47. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire/test/utils.py +0 -0
  48. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire.egg-info/SOURCES.txt +0 -0
  49. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire.egg-info/dependency_links.txt +0 -0
  50. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire.egg-info/requires.txt +0 -0
  51. {spotfire-2.4.2 → spotfire-2.4.3}/spotfire.egg-info/top_level.txt +0 -0
  52. {spotfire-2.4.2 → spotfire-2.4.3}/test_requirements_default.txt +0 -0
  53. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/__init__.pxd +0 -0
  54. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/all.h +0 -0
  55. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/all_io.h +0 -0
  56. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/bytearray.h +0 -0
  57. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/columnmetadata.h +0 -0
  58. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/columnslice.h +0 -0
  59. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/columnslice_io.h +0 -0
  60. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/config.h +0 -0
  61. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/errors.h +0 -0
  62. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/fileheader.h +0 -0
  63. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/metadata.h +0 -0
  64. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/object.h +0 -0
  65. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/object_io.h +0 -0
  66. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/sbdfstring.h +0 -0
  67. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/sectiontypeid.h +0 -0
  68. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/sectiontypeid_io.h +0 -0
  69. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/tablemetadata.h +0 -0
  70. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/tablemetadata_io.h +0 -0
  71. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/tableslice.h +0 -0
  72. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/tableslice_io.h +0 -0
  73. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/valuearray_io.h +0 -0
  74. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/valuetype.h +0 -0
  75. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/valuetype_io.h +0 -0
  76. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/include/valuetypeid.h +0 -0
  77. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/bswap.c +0 -0
  78. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/bswap.h +0 -0
  79. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/bytearray.c +0 -0
  80. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/columnmetadata.c +0 -0
  81. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/errors.c +0 -0
  82. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/fileheader.c +0 -0
  83. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/metadata.c +0 -0
  84. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/sbdfstring.c +0 -0
  85. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf-c/src/valuetype.c +0 -0
  86. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/sbdf_c.pxd +0 -0
  87. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/windows/fci.pxd +0 -0
  88. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/windows/mssign32.h +0 -0
  89. {spotfire-2.4.2 → spotfire-2.4.3}/vendor/windows/mssign32.pxd +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spotfire
3
- Version: 2.4.2
3
+ Version: 2.4.3
4
4
  Summary: Package for Building Python Extensions to Spotfire
5
5
  Author: Cloud Software Group, Inc.
6
6
  Maintainer-email: Spotfire Python Package Support <spotfirepython@tibco.com>
@@ -0,0 +1,8 @@
1
+ # Copyright © 2021. Cloud Software Group, Inc.
2
+ # This file is subject to the license terms contained
3
+ # in the license file that is distributed with this file.
4
+
5
+ """User visible utility functions."""
6
+
7
+ from spotfire.public import (copy_metadata, get_spotfire_types, set_spotfire_types, set_geocoding_table,
8
+ get_table_metadata, set_table_metadata, get_column_metadata, set_column_metadata)
@@ -5,6 +5,13 @@
5
5
  #ifndef SPOTFIRE_CABFILE_HELPERS_H_
6
6
  #define SPOTFIRE_CABFILE_HELPERS_H_
7
7
 
8
+ /* The FCI callback types only exist on Windows. Without this guard, other platforms see the
9
+ declarations below as implicit-int declarations, which GCC 14 and later reject as errors. */
10
+ #ifdef _WIN32
11
+
12
+ #include <windows.h>
13
+ #include <fci.h>
14
+
8
15
  extern FNFCIALLOC(_fci_cb_alloc);
9
16
  extern FNFCIFREE(_fci_cb_free);
10
17
  extern FNFCIOPEN(_fci_cb_open);
@@ -19,4 +26,6 @@ extern FNFCISTATUS(_fci_cb_status);
19
26
  extern FNFCIGETNEXTCABINET(_fci_cb_get_next_cabinet);
20
27
  extern FNFCIGETOPENINFO(_fci_cb_get_open_info);
21
28
 
29
+ #endif /* _WIN32 */
30
+
22
31
  #endif /* SPOTFIRE_CABFILE_HELPERS_H_ */
@@ -42,7 +42,8 @@ cpdef void codesign_file(filename,
42
42
  or PKCS#12 container.
43
43
 
44
44
  :param filename: the filename of the file to codesign
45
- :param certificate: the filename of the certificate file to codesign with
45
+ :param certificate: the filename of the certificate file to codesign with. If the file contains several
46
+ certificates, the currently valid one with a private key that expires last is used.
46
47
  :param password: the password used to unlock the certificate
47
48
  :param timestamp: a URL of the timestamping service to timestamp the code signature with
48
49
  :param use_rfc3161: whether or not to use the RFC 3161 timestamping protocol. If ``True``, use RFC 3161.
@@ -103,7 +104,8 @@ cpdef void codesign_file_from_store(filename,
103
104
  :param store_location: the location of the Windows certificate store to find the certificate to sign with in
104
105
  :param store_name: the name of the Windows certificate store to find the certificate to sign with in
105
106
  :param store_cn: a string specifying the subject common name (or a substring thereof) of the certificate to
106
- sign with
107
+ sign with. If several certificates match, the currently valid one with a private key that expires last
108
+ is used.
107
109
  :param timestamp: a URL of the timestamping service to timestamp the code signature with
108
110
  :param use_rfc3161: whether or not to use the RFC 3161 timestamping protocol. If ``True``, use RFC 3161.
109
111
  If ``False``, use Authenticode.
@@ -165,7 +167,8 @@ cdef windows.LPCWSTR _object_to_wstr(object obj):
165
167
 
166
168
  obj_bytes = str(obj).encode("utf-8")
167
169
  len_ = windows.MultiByteToWideChar(windows.CP_UTF8, 0, obj_bytes, <int>len(obj_bytes), NULL, 0)
168
- wstr = <windows.LPCWSTR>stdlib.calloc(len_, sizeof(windows.WCHAR))
170
+ # Allocate one extra (zeroed) character for the null terminator, which MultiByteToWideChar does not write
171
+ wstr = <windows.LPCWSTR>stdlib.calloc(len_ + 1, sizeof(windows.WCHAR))
169
172
  windows.MultiByteToWideChar(windows.CP_UTF8, 0, obj_bytes, <int>len(obj_bytes), <windows.LPWSTR>wstr, len_)
170
173
 
171
174
  return wstr
@@ -183,7 +186,10 @@ cdef void _codesign_file_core(filename,
183
186
  cdef mssign32.SignerTimeStampEx2Type signer_time_stamp_ex2_fun
184
187
  cdef mssign32.SignerFreeSignerContextType signer_free_signer_context_fun
185
188
  cdef const wincrypt.CERT_CONTEXT* cert_context = NULL
189
+ cdef const wincrypt.CERT_CONTEXT* candidate = NULL
186
190
  cdef windows.DWORD key_spec, key_spec_len
191
+ cdef unsigned char thumbprint[20]
192
+ cdef windows.DWORD thumbprint_len
187
193
  cdef mssign32.SIGNER_FILE_INFO signer_file_info
188
194
  cdef mssign32.SIGNER_SUBJECT_INFO signer_subject_info
189
195
  cdef windows.DWORD index
@@ -220,27 +226,33 @@ cdef void _codesign_file_core(filename,
220
226
  if signer_free_signer_context_fun is NULL:
221
227
  raise CodesignError("Cannot find function 'SignerFreeSignerContext'")
222
228
 
223
- # Extract the cert from the store
224
- cert_context = wincrypt.CertFindCertificateInStore(cert_store,
225
- wincrypt.X509_ASN_ENCODING | wincrypt.PKCS_7_ASN_ENCODING,
226
- 0, cert_find_type, cert_find_param, NULL)
227
- if cert_context is NULL:
228
- raise CodesignError("Could not get certificate from store")
229
- found_private_key = False
230
- while not found_private_key:
229
+ # Extract the cert from the store. Of all the matching certs that have a private key and are currently
230
+ # valid, use the one that expires last.
231
+ candidate = wincrypt.CertFindCertificateInStore(cert_store,
232
+ wincrypt.X509_ASN_ENCODING | wincrypt.PKCS_7_ASN_ENCODING,
233
+ 0, cert_find_type, cert_find_param, NULL)
234
+ while candidate is not NULL:
231
235
  key_spec_len = sizeof(key_spec)
232
- has_private_key = wincrypt.CertGetCertificateContextProperty(cert_context,
236
+ has_private_key = wincrypt.CertGetCertificateContextProperty(candidate,
233
237
  wincrypt.CERT_KEY_SPEC_PROP_ID,
234
238
  &key_spec, &key_spec_len)
235
- if has_private_key:
236
- found_private_key = True
237
- else:
238
- cert_context = wincrypt.CertFindCertificateInStore(cert_store,
239
- wincrypt.X509_ASN_ENCODING |
240
- wincrypt.PKCS_7_ASN_ENCODING,
241
- 0, cert_find_type, cert_find_param, cert_context)
242
- if cert_context is NULL:
243
- raise CodesignError("Could not get certificate from store")
239
+ is_time_valid = wincrypt.CertVerifyTimeValidity(NULL, candidate.pCertInfo) == 0
240
+ if has_private_key and is_time_valid:
241
+ if cert_context is NULL or windows.CompareFileTime(&candidate.pCertInfo.NotAfter,
242
+ &cert_context.pCertInfo.NotAfter) > 0:
243
+ if cert_context is not NULL:
244
+ wincrypt.CertFreeCertificateContext(cert_context)
245
+ cert_context = wincrypt.CertDuplicateCertificateContext(candidate)
246
+ # Passing the previous context frees it
247
+ candidate = wincrypt.CertFindCertificateInStore(cert_store,
248
+ wincrypt.X509_ASN_ENCODING | wincrypt.PKCS_7_ASN_ENCODING,
249
+ 0, cert_find_type, cert_find_param, candidate)
250
+ if cert_context is NULL:
251
+ raise CodesignError("Could not find a currently valid certificate with a private key in store")
252
+ thumbprint_len = sizeof(thumbprint)
253
+ if wincrypt.CertGetCertificateContextProperty(cert_context, wincrypt.CERT_SHA1_HASH_PROP_ID,
254
+ thumbprint, &thumbprint_len):
255
+ print(f"Signing {filename} with certificate {(<char*>thumbprint)[:thumbprint_len].hex().upper()}")
244
256
 
245
257
  # Prepare structures
246
258
  signer_file_info.cbSize = sizeof(mssign32.SIGNER_FILE_INFO)
@@ -21,6 +21,54 @@ _ColumnTypes = dict[str, str]
21
21
 
22
22
  # Table and column metadata functions
23
23
 
24
+ def get_table_metadata(dataframe):
25
+ """Get the table-level Spotfire metadata from a DataFrame.
26
+
27
+ :param dataframe: the DataFrame to get the table metadata from
28
+ :returns: a dict containing the table metadata, or an empty dict if none
29
+ """
30
+ try:
31
+ return dataframe.spotfire_table_metadata
32
+ except AttributeError:
33
+ return {}
34
+
35
+
36
+ def set_table_metadata(dataframe, metadata):
37
+ """Set the table-level Spotfire metadata on a DataFrame.
38
+
39
+ :param dataframe: the DataFrame to set the table metadata on
40
+ :param metadata: a dict containing the table metadata
41
+ """
42
+ with warnings.catch_warnings():
43
+ warnings.simplefilter("ignore")
44
+ dataframe.spotfire_table_metadata = metadata # type: ignore[attr-defined]
45
+
46
+
47
+ def get_column_metadata(dataframe, col):
48
+ """Get the Spotfire column metadata for a specific column.
49
+
50
+ :param dataframe: the DataFrame containing the column
51
+ :param col: the name of the column
52
+ :returns: a dict containing the column metadata, or an empty dict if none
53
+ """
54
+ try:
55
+ return dataframe[col].spotfire_column_metadata
56
+ except AttributeError:
57
+ return {}
58
+
59
+
60
+ def set_column_metadata(dataframe, col, metadata):
61
+ """Set the Spotfire column metadata for a specific column.
62
+
63
+ :param dataframe: the DataFrame containing the column
64
+ :param col: the name of the column
65
+ :param metadata: a dict containing the column metadata
66
+ """
67
+ with warnings.catch_warnings():
68
+ warnings.simplefilter("ignore")
69
+ dataframe[col].spotfire_column_metadata = metadata # type: ignore[attr-defined]
70
+
71
+
24
72
  def copy_metadata(source, destination) -> None:
25
73
  """Copy the table and column metadata from a Pandas object to another.
26
74
 
@@ -16,6 +16,7 @@ import locale
16
16
  import os
17
17
  import platform
18
18
  import re
19
+ import shlex
19
20
  import shutil
20
21
  import subprocess
21
22
  import sys
@@ -667,8 +668,8 @@ class _ZipPackageBuilder(_PackageBuilder):
667
668
  filename_payload_fwdslash = filename_payload.replace("\\", "/")[5:]
668
669
  if os.path.islink(filename_ondisk):
669
670
  payload_script += "if [ ! -e {payload} ]; then ln -s {ondisk} {payload}; fi\n".format(
670
- payload=filename_payload_fwdslash,
671
- ondisk=os.readlink(filename_ondisk))
671
+ payload=shlex.quote(filename_payload_fwdslash),
672
+ ondisk=shlex.quote(os.readlink(filename_ondisk)))
672
673
  else:
673
674
  payload.write(filename_ondisk, filename_payload.replace("\\", "/"))
674
675
  stat = os.lstat(filename_ondisk)
@@ -679,7 +680,7 @@ class _ZipPackageBuilder(_PackageBuilder):
679
680
  .strftime("%Y-%m-%dT%H:%M:%SZ")),
680
681
  })
681
682
  if platform.system() != "Windows" and mode != 0o644:
682
- payload_script += f"chmod {mode:o} {filename_payload_fwdslash}\n"
683
+ payload_script += f"chmod {mode:o} {shlex.quote(filename_payload_fwdslash)}\n"
683
684
 
684
685
  # Add the payload script if we added any lines
685
686
  if payload_script:
@@ -802,8 +803,9 @@ class _CabPackageBuilder(_PackageBuilder):
802
803
  argument("--store-name", metavar="STORE", help="name of the certificate store to find the certificate "
803
804
  "to sign the package in (Analyst only)"),
804
805
  argument("--store-cn", metavar="STRING", help="substring of the subject common name of the certificate "
805
- "in the certificate store to sign the package with (Analyst "
806
- "only)"),
806
+ "in the certificate store to sign the package with; if "
807
+ "several match, the valid one that expires last is used "
808
+ "(Analyst only)"),
807
809
  argument("--timestamp", metavar="URL", help="URL of a timestamping service to timestamp the package with "
808
810
  "(Analyst only)"),
809
811
  argument("--sha256", action="store_true", help="use SHA-256 for file and timestamp digests (Analyst only)")
@@ -895,8 +897,9 @@ def python(args, hook=None) -> None:
895
897
  argument("--store-name", metavar="STORE", help="name of the certificate store to find the certificate "
896
898
  "to sign the package in (Analyst only)"),
897
899
  argument("--store-cn", metavar="STRING", help="substring of the subject common name of the certificate "
898
- "in the certificate store to sign the package with (Analyst "
899
- "only)"),
900
+ "in the certificate store to sign the package with; if "
901
+ "several match, the valid one that expires last is used "
902
+ "(Analyst only)"),
900
903
  argument("--timestamp", metavar="URL", help="URL of a timestamping service to timestamp the package with "
901
904
  "(Analyst only)"),
902
905
  argument("--sha256", action="store_true", help="use SHA-256 for file and timestamp digests (Analyst only)")
@@ -179,11 +179,12 @@ class SbdfTest(unittest.TestCase):
179
179
  'd': pd.Series([10., pd.NA, 12.], dtype='Float64')
180
180
  })
181
181
  df2 = self._roundtrip_dataframe(dataframe)
182
- self.assertTrue(pd.isna(df2.at[2, 'b']))
183
- self.assertTrue(pd.isna(df2.at[1, 'i']))
184
- self.assertTrue(pd.isna(df2.at[0, 'l']))
185
- self.assertTrue(pd.isna(df2.at[2, 'f']))
186
- self.assertTrue(pd.isna(df2.at[1, 'd']))
182
+ df2_na = df2.isna()
183
+ self.assertTrue(df2_na.at[2, 'b'])
184
+ self.assertTrue(df2_na.at[1, 'i'])
185
+ self.assertTrue(df2_na.at[0, 'l'])
186
+ self.assertTrue(df2_na.at[2, 'f'])
187
+ self.assertTrue(df2_na.at[1, 'd'])
187
188
 
188
189
  def test_get_spotfire_types(self):
189
190
  """All types should be reported properly."""
@@ -445,7 +446,8 @@ class SbdfTest(unittest.TestCase):
445
446
  }
446
447
  for resolution, timestamp in inputs.items():
447
448
  with self.subTest(resolution=resolution):
448
- array = np.array([[0], [timestamp]]).astype(f"datetime64[{resolution}]")
449
+ array: np.ndarray = np.array([[0], [timestamp]])
450
+ array = array.astype(f"datetime64[{resolution}]")
449
451
  dataframe = pd.DataFrame(array, columns=["x"])
450
452
  df2 = self._roundtrip_dataframe(dataframe)
451
453
  val = df2.at[1, 'x']
@@ -462,7 +464,8 @@ class SbdfTest(unittest.TestCase):
462
464
  }
463
465
  for resolution, timestamp in inputs.items():
464
466
  with self.subTest(resolution=resolution):
465
- array = np.array([[0], [timestamp]]).astype(f"timedelta64[{resolution}]")
467
+ array: np.ndarray = np.array([[0], [timestamp]])
468
+ array = array.astype(f"timedelta64[{resolution}]")
466
469
  dataframe = pd.DataFrame(array, columns=["x"])
467
470
  df2 = self._roundtrip_dataframe(dataframe)
468
471
  val = df2.at[1, 'x']
@@ -3,4 +3,4 @@
3
3
  # in the license file that is distributed with this file.
4
4
 
5
5
  # pylint: skip-file
6
- __version__="2.4.2"
6
+ __version__="2.4.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spotfire
3
- Version: 2.4.2
3
+ Version: 2.4.3
4
4
  Summary: Package for Building Python Extensions to Spotfire
5
5
  Author: Cloud Software Group, Inc.
6
6
  Maintainer-email: Spotfire Python Package Support <spotfirepython@tibco.com>
@@ -48,6 +48,9 @@ SBDF_API int sbdf_va_get_values(sbdf_valuearray* input, sbdf_object** result);
48
48
  /* returns the number of rows stored in the value array */
49
49
  SBDF_API int sbdf_va_row_cnt(sbdf_valuearray* in);
50
50
 
51
+ /* returns the value type of the value array */
52
+ SBDF_API int sbdf_va_get_type(sbdf_valuearray* in, struct sbdf_valuetype* out);
53
+
51
54
  #ifdef __cplusplus
52
55
  }
53
56
  #endif
@@ -207,19 +207,27 @@ int sbdf_cs_read(FILE* f, sbdf_columnslice** out)
207
207
  goto end;
208
208
  }
209
209
 
210
+ if (v > 4096)
211
+ {
212
+ error = SBDF_ERROR_INVALID_SIZE;
213
+ goto end;
214
+ }
215
+
210
216
  t->prop_cnt = v;
211
217
  /* TODO Verify that it is OK to have no properties */
212
218
  if (v > 0)
213
219
  {
214
- if (error = sbdf_alloc((void**)&t->properties, v * sizeof(void*)))
220
+ if (error = sbdf_alloc((void**)&t->properties, (size_t)v * sizeof(void*)))
215
221
  {
216
222
  goto end;
217
223
  }
224
+ memset(t->properties, 0, (size_t)v * sizeof(void*));
218
225
 
219
- if (error = sbdf_alloc((void**)&t->property_names, v * sizeof(void*)))
226
+ if (error = sbdf_alloc((void**)&t->property_names, (size_t)v * sizeof(void*)))
220
227
  {
221
228
  goto end;
222
229
  }
230
+ memset(t->property_names, 0, (size_t)v * sizeof(void*));
223
231
 
224
232
  for (i = 0; i < v; ++i)
225
233
  {
@@ -184,7 +184,7 @@ int sbdf_read_string(FILE* f, char** s)
184
184
  return error;
185
185
  }
186
186
 
187
- if (l < 0)
187
+ if (l < 0 || l > 64 * 1024 * 1024)
188
188
  {
189
189
  return SBDF_ERROR_INVALID_SIZE;
190
190
  }
@@ -323,11 +323,11 @@ void* sbdf_copy_array(void const* src)
323
323
  return dst;
324
324
  }
325
325
 
326
- int sbdf_alloc(void** inout, int sz)
326
+ int sbdf_alloc(void** inout, size_t sz)
327
327
  {
328
328
  void* t;
329
329
 
330
- if (sz <= 0)
330
+ if (sz == 0)
331
331
  {
332
332
  return SBDF_ERROR_INVALID_SIZE;
333
333
  }
@@ -81,7 +81,7 @@ extern void* sbdf_copy_array(void const* src);
81
81
  extern int sbdf_init_array_dontclone(struct sbdf_valuetype type, int count, void const* data, struct sbdf_object** out);
82
82
 
83
83
  /* allocates / reallocates the given amount of memory */
84
- extern int sbdf_alloc(void** inout, int sz);
84
+ extern int sbdf_alloc(void** inout, size_t sz);
85
85
 
86
86
  /* determines if the type index is an array type index */
87
87
  extern int sbdf_ti_is_arr(int);
@@ -2,6 +2,7 @@
2
2
  This file is subject to the license terms contained in the
3
3
  license file that is distributed with this file. */
4
4
 
5
+ #include <limits.h>
5
6
  #include <stdlib.h>
6
7
  #include <string.h>
7
8
 
@@ -259,7 +260,7 @@ static int sbdf_read_objects(FILE* f, sbdf_valuetype v, int count, sbdf_object**
259
260
  return err;
260
261
  }
261
262
 
262
- if (length < 0)
263
+ if (length < 0 || length > 64 * 1024 * 1024)
263
264
  {
264
265
  sbdf_obj_destroy(t);
265
266
  return SBDF_ERROR_INVALID_SIZE;
@@ -302,7 +303,12 @@ static int sbdf_read_objects(FILE* f, sbdf_valuetype v, int count, sbdf_object**
302
303
  sbdf_obj_destroy(t);
303
304
  return SBDF_ERROR_UNKNOWN_TYPEID;
304
305
  }
305
- t->data = malloc(sz * count);
306
+ if (count > 0 && (size_t)count > (size_t)INT_MAX / (size_t)sz)
307
+ {
308
+ sbdf_obj_destroy(t);
309
+ return SBDF_ERROR_INVALID_SIZE;
310
+ }
311
+ t->data = malloc((size_t)sz * (size_t)count);
306
312
  if (!t->data)
307
313
  {
308
314
  sbdf_obj_destroy(t);
@@ -549,6 +555,13 @@ static int sbdf_skip_objects(FILE* f, sbdf_valuetype v, int c, int packed_array)
549
555
  return err;
550
556
  }
551
557
 
558
+ /* a negative length seeks backwards, which lets a crafted file
559
+ rewind the parser onto data it has already consumed. */
560
+ if (skip < 0)
561
+ {
562
+ return SBDF_ERROR_INVALID_SIZE;
563
+ }
564
+
552
565
  if (fseek(f, skip, SEEK_CUR))
553
566
  {
554
567
  return SBDF_ERROR_IO;
@@ -563,6 +576,11 @@ static int sbdf_skip_objects(FILE* f, sbdf_valuetype v, int c, int packed_array)
563
576
  return err;
564
577
  }
565
578
 
579
+ if (skip < 0)
580
+ {
581
+ return SBDF_ERROR_INVALID_SIZE;
582
+ }
583
+
566
584
  if (fseek(f, skip, SEEK_CUR))
567
585
  {
568
586
  return SBDF_ERROR_IO;
@@ -581,7 +599,12 @@ static int sbdf_skip_objects(FILE* f, sbdf_valuetype v, int c, int packed_array)
581
599
  {
582
600
  return SBDF_ERROR_UNKNOWN_TYPEID;
583
601
  }
584
- if (fseek(f, c * sz, SEEK_CUR))
602
+ /* c * sz overflows int for large counts, and fseek takes a long. */
603
+ if (c > LONG_MAX / sz)
604
+ {
605
+ return SBDF_ERROR_INVALID_SIZE;
606
+ }
607
+ if (fseek(f, (long)c * sz, SEEK_CUR))
585
608
  {
586
609
  return SBDF_ERROR_IO;
587
610
  }
@@ -453,13 +453,17 @@ struct metadata_sort
453
453
  int order;
454
454
  };
455
455
 
456
- static int compare_metadata_sort_by_order(struct metadata_sort const* lhs, struct metadata_sort const* rhs)
456
+ static int compare_metadata_sort_by_order(void const* lhs_, void const* rhs_)
457
457
  {
458
+ struct metadata_sort const* lhs = (struct metadata_sort const*)lhs_;
459
+ struct metadata_sort const* rhs = (struct metadata_sort const*)rhs_;
458
460
  return lhs->order - rhs->order;
459
461
  }
460
462
 
461
- static int compare_metadata_sort_by_name(struct metadata_sort const* lhs, struct metadata_sort const* rhs)
463
+ static int compare_metadata_sort_by_name(void const* lhs_, void const* rhs_)
462
464
  {
465
+ struct metadata_sort const* lhs = (struct metadata_sort const*)lhs_;
466
+ struct metadata_sort const* rhs = (struct metadata_sort const*)rhs_;
463
467
  int name_diff = strcmp(lhs->meta->name, rhs->meta->name);
464
468
  if (name_diff)
465
469
  {
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include "tableslice.h"
6
6
 
7
+ #include <limits.h>
7
8
  #include <stdlib.h>
8
9
 
9
10
  #include "columnslice.h"
@@ -11,6 +12,8 @@
11
12
  #include "tableslice_io.h"
12
13
  #include "metadata.h"
13
14
  #include "tablemetadata.h"
15
+ #include "columnmetadata.h"
16
+ #include "valuearray.h"
14
17
  #include "errors.h"
15
18
  #include "sectiontypeid.h"
16
19
  #include "sectiontypeid_io.h"
@@ -51,12 +54,23 @@ int sbdf_ts_add(sbdf_columnslice* col, sbdf_tableslice* table)
51
54
  return SBDF_ERROR_ARGUMENT_NULL;
52
55
  }
53
56
 
57
+ /* sbdf_calculate_array_capacity grows past its argument, so both the
58
+ increment and the capacity it returns can overflow. */
59
+ if (table->no_columns >= INT_MAX - 1)
60
+ {
61
+ return SBDF_ERROR_INVALID_SIZE;
62
+ }
63
+
54
64
  cap = sbdf_calculate_array_capacity(table->no_columns);
55
65
 
56
66
  if (cap == table->no_columns)
57
67
  {
58
68
  int new_cap = sbdf_calculate_array_capacity(1 + table->no_columns);
59
- if (error = sbdf_alloc((void**)&table->columns, new_cap * sizeof(void*)))
69
+ if (new_cap < 0)
70
+ {
71
+ return SBDF_ERROR_INVALID_SIZE;
72
+ }
73
+ if (error = sbdf_alloc((void**)&table->columns, (size_t)new_cap * sizeof(void*)))
60
74
  {
61
75
  return error;
62
76
  }
@@ -96,7 +110,7 @@ void sbdf_ts_destroy(sbdf_tableslice* slice)
96
110
  int sbdf_ts_read(FILE* f, sbdf_tablemetadata const* meta, char* subset, sbdf_tableslice** out)
97
111
  {
98
112
  sbdf_tableslice* t;
99
- int error, v, i, column_count;
113
+ int error, v, i, column_count, row_cnt;
100
114
 
101
115
  if (!meta || !out)
102
116
  {
@@ -149,11 +163,41 @@ int sbdf_ts_read(FILE* f, sbdf_tablemetadata const* meta, char* subset, sbdf_tab
149
163
  t->table_metadata = (sbdf_tablemetadata*)meta;
150
164
  t->no_columns = column_count;
151
165
 
166
+ row_cnt = -1;
167
+
152
168
  for (i = 0; i < t->no_columns; ++i)
153
169
  {
154
170
  if (!subset || subset[i])
155
171
  {
172
+ sbdf_valuetype meta_vt, slice_vt;
156
173
  error = sbdf_cs_read(f, t->columns + i);
174
+ if (!error &&
175
+ (sbdf_cm_get_type(meta->column_metadata[i], &meta_vt) != SBDF_OK ||
176
+ sbdf_va_get_type(((sbdf_columnslice*)t->columns[i])->values, &slice_vt) != SBDF_OK ||
177
+ slice_vt.id != meta_vt.id))
178
+ {
179
+ error = SBDF_ERROR_VALUETYPES_MUST_BE_EQUAL;
180
+ }
181
+
182
+ /* every column slice of a table slice must describe the same rows.
183
+ otherwise a consumer that derives a copy length from one column
184
+ reads past the end of a shorter one. */
185
+ if (!error)
186
+ {
187
+ int cnt = sbdf_cs_row_cnt((sbdf_columnslice*)t->columns[i]);
188
+ if (cnt < 0)
189
+ {
190
+ error = cnt;
191
+ }
192
+ else if (row_cnt < 0)
193
+ {
194
+ row_cnt = cnt;
195
+ }
196
+ else if (cnt != row_cnt)
197
+ {
198
+ error = SBDF_ERROR_ROW_COUNT_MISMATCH;
199
+ }
200
+ }
157
201
  }
158
202
  else
159
203
  {
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include "valuearray.h"
6
6
 
7
+ #include <limits.h>
7
8
  #include <stdlib.h>
8
9
  #include <string.h>
9
10
 
@@ -282,10 +283,14 @@ int sbdf_va_create_bit(sbdf_object const* array, sbdf_valuearray** handle)
282
283
  elem_size = sbdf_get_unpacked_size(vt);
283
284
  if (elem_size < 0)
284
285
  {
286
+ free(*handle);
287
+ *handle = 0;
285
288
  return elem_size;
286
289
  }
287
290
  else if (elem_size == 0)
288
291
  {
292
+ free(*handle);
293
+ *handle = 0;
289
294
  return SBDF_ERROR_UNKNOWN_TYPEID;
290
295
  }
291
296
  }
@@ -297,6 +302,7 @@ int sbdf_va_create_bit(sbdf_object const* array, sbdf_valuearray** handle)
297
302
  if (!out)
298
303
  {
299
304
  free(*handle);
305
+ *handle = 0;
300
306
  return SBDF_ERROR_OUT_OF_MEMORY;
301
307
  }
302
308
 
@@ -345,7 +351,9 @@ int sbdf_va_create_bit(sbdf_object const* array, sbdf_valuearray** handle)
345
351
  t = calloc(1, sizeof(sbdf_object));
346
352
  if (!t)
347
353
  {
354
+ free(out - packed_len);
348
355
  free(*handle);
356
+ *handle = 0;
349
357
  return SBDF_ERROR_OUT_OF_MEMORY;
350
358
  }
351
359
  t->type = bytearray_vt;
@@ -353,17 +361,23 @@ int sbdf_va_create_bit(sbdf_object const* array, sbdf_valuearray** handle)
353
361
  t->data = malloc(sizeof(void*));
354
362
  if (!t->data)
355
363
  {
356
- free(*handle);
364
+ free(out - packed_len);
357
365
  free(t);
366
+ free(*handle);
367
+ *handle = 0;
358
368
  return SBDF_ERROR_OUT_OF_MEMORY;
359
369
  }
360
370
 
371
+ /* the allocation to test is the byte array, not t->data, which was just
372
+ checked above. free t->data before t, not after. */
361
373
  *(void**)t->data = sbdf_ba_create(out - packed_len, packed_len);
362
- if (!t->data)
374
+ if (!*(void**)t->data)
363
375
  {
364
- free(*handle);
365
- free(t);
376
+ free(out - packed_len);
366
377
  free(t->data);
378
+ free(t);
379
+ free(*handle);
380
+ *handle = 0;
367
381
  return SBDF_ERROR_OUT_OF_MEMORY;
368
382
  }
369
383
 
@@ -428,6 +442,28 @@ static int sbdf_get_rle_values(sbdf_valuearray* handle, sbdf_object** result)
428
442
  return SBDF_ERROR_UNKNOWN_TYPEID;
429
443
  }
430
444
 
445
+ /* Validate: sum of decoded elements must equal declared count, and run count must not
446
+ exceed value count (prevents heap OOB write and secondary over-read). */
447
+ {
448
+ int total = 0;
449
+ for (i = 0; i < handle->object1->count; ++i)
450
+ {
451
+ int run = ((unsigned char *)handle->object1->data)[i] + 1;
452
+ /* the sum itself must not overflow, or it wraps back onto a small
453
+ value1 and the comparison below lets the decode loop run past
454
+ the allocation. */
455
+ if (total > INT_MAX - run)
456
+ {
457
+ return SBDF_ERROR_INVALID_SIZE;
458
+ }
459
+ total += run;
460
+ }
461
+ if (total != handle->value1 || handle->object1->count > handle->object2->count)
462
+ {
463
+ return SBDF_ERROR_INVALID_SIZE;
464
+ }
465
+ }
466
+
431
467
  if (!(t = calloc(1, sizeof(sbdf_object))))
432
468
  {
433
469
  return SBDF_ERROR_OUT_OF_MEMORY;
@@ -435,7 +471,7 @@ static int sbdf_get_rle_values(sbdf_valuearray* handle, sbdf_object** result)
435
471
  t->type = handle->object2->type;
436
472
  t->count = elem_cnt = handle->value1;
437
473
 
438
- if (!(t->data = malloc(elem_size * elem_cnt)))
474
+ if (!(t->data = malloc((size_t)elem_size * (size_t)elem_cnt)))
439
475
  {
440
476
  sbdf_obj_destroy(t);
441
477
  return SBDF_ERROR_OUT_OF_MEMORY;
@@ -561,6 +597,15 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
561
597
  return err;
562
598
  }
563
599
 
600
+ /* a bit array always decodes to one byte per element and reports itself as
601
+ bool, whatever the header claims the type is. accepting any other type
602
+ here hands the caller an object whose element width does not match the
603
+ type it asked for. the writer only ever emits bool bit arrays. */
604
+ if (e == SBDF_BITARRAYENCODINGTYPEID && vt.id != SBDF_BOOLTYPEID)
605
+ {
606
+ return SBDF_ERROR_UNKNOWN_VALUEARRAY_ENCODING;
607
+ }
608
+
564
609
  if (handle)
565
610
  {
566
611
  *handle = calloc(sizeof(sbdf_valuearray), 1);
@@ -588,6 +633,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
588
633
  if (handle)
589
634
  {
590
635
  sbdf_va_destroy(*handle);
636
+ *handle = 0;
591
637
  }
592
638
  return err;
593
639
  }
@@ -600,9 +646,20 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
600
646
  if (err)
601
647
  {
602
648
  sbdf_va_destroy(*handle);
649
+ *handle = 0;
603
650
  return err;
604
651
  }
605
652
 
653
+ /* sbdf_va_row_cnt hands this straight back to callers sizing
654
+ buffers, before anything has decoded the runs. bound it the
655
+ same way the bit array branch below bounds its own count. */
656
+ if ((*handle)->value1 < 0 || (*handle)->value1 > 256 * 1024 * 1024)
657
+ {
658
+ sbdf_va_destroy(*handle);
659
+ *handle = 0;
660
+ return SBDF_ERROR_INVALID_SIZE;
661
+ }
662
+
606
663
  err = sbdf_obj_read_arr(file, byte_vt, &(*handle)->object1);
607
664
  }
608
665
  else
@@ -615,6 +672,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
615
672
  if (handle)
616
673
  {
617
674
  sbdf_va_destroy(*handle);
675
+ *handle = 0;
618
676
  }
619
677
  return err;
620
678
  }
@@ -633,6 +691,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
633
691
  if (handle)
634
692
  {
635
693
  sbdf_va_destroy(*handle);
694
+ *handle = 0;
636
695
  }
637
696
  return err;
638
697
  }
@@ -649,6 +708,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
649
708
  if (handle)
650
709
  {
651
710
  sbdf_va_destroy(*handle);
711
+ *handle = 0;
652
712
  }
653
713
  return err;
654
714
  }
@@ -658,6 +718,16 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
658
718
  (*handle)->value1 = v;
659
719
  }
660
720
 
721
+ if (v < 0 || v > 256 * 1024 * 1024)
722
+ {
723
+ if (handle)
724
+ {
725
+ sbdf_va_destroy(*handle);
726
+ *handle = 0;
727
+ }
728
+ return SBDF_ERROR_INVALID_SIZE;
729
+ }
730
+
661
731
  /* just read the raw byte stream */
662
732
  packed_size = v / 8 + !!(v%8);
663
733
  if (handle)
@@ -666,6 +736,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
666
736
  if (!buf)
667
737
  {
668
738
  sbdf_va_destroy(*handle);
739
+ *handle = 0;
669
740
  return SBDF_ERROR_OUT_OF_MEMORY;
670
741
  }
671
742
 
@@ -673,6 +744,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
673
744
  {
674
745
  free(buf);
675
746
  sbdf_va_destroy(*handle);
747
+ *handle = 0;
676
748
  return SBDF_ERROR_IO;
677
749
  }
678
750
  err = sbdf_obj_create(bytearray_vt, &buf, &packed_size, &(*handle)->object1);
@@ -688,6 +760,7 @@ static int sbdf_read_valuearray_int(FILE* file, sbdf_valuearray** handle)
688
760
  if (handle)
689
761
  {
690
762
  sbdf_va_destroy(*handle);
763
+ *handle = 0;
691
764
  }
692
765
  return err;
693
766
  }
@@ -795,6 +868,16 @@ int sbdf_va_create_dflt(sbdf_object const* array, sbdf_valuearray** handle)
795
868
  }
796
869
  }
797
870
 
871
+ int sbdf_va_get_type(sbdf_valuearray* in, sbdf_valuetype* out)
872
+ {
873
+ if (!in || !out)
874
+ {
875
+ return SBDF_ERROR_ARGUMENT_NULL;
876
+ }
877
+ *out = in->valuetype;
878
+ return SBDF_OK;
879
+ }
880
+
798
881
  int sbdf_va_row_cnt(sbdf_valuearray* in)
799
882
  {
800
883
  if (!in)
@@ -11,6 +11,15 @@ cdef extern from "<windows.h>" nogil:
11
11
  ctypedef Py_ssize_t INT_PTR
12
12
  ctypedef unsigned int UINT
13
13
  ctypedef Py_ssize_t ULONG_PTR
14
+ ctypedef long LONG
15
+
16
+ # Structure defined at https://learn.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime
17
+ ctypedef struct FILETIME:
18
+ DWORD dwLowDateTime
19
+ DWORD dwHighDateTime
20
+
21
+ # Function defined at https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-comparefiletime
22
+ cdef LONG CompareFileTime(const FILETIME*, const FILETIME*)
14
23
 
15
24
  # Preprocessor definitions defined at https://docs.microsoft.com/en-us/windows/win32/seccrypto/common-hresult-values
16
25
  cdef enum:
@@ -7,13 +7,18 @@ cdef extern from "<wincrypt.h>" nogil:
7
7
  X509_ASN_ENCODING
8
8
  PKCS_7_ASN_ENCODING
9
9
 
10
+ # Structure defined at https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/ns-wincrypt-cert_info
11
+ ctypedef struct CERT_INFO:
12
+ windows.FILETIME NotAfter
13
+
10
14
  # Structure defined at https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/ns-wincrypt-cert_context
11
15
  ctypedef struct CERT_CONTEXT:
12
- pass
16
+ CERT_INFO* pCertInfo
13
17
 
14
18
  # Preprocessor definitions for CertGetCertificateContextProperty function
15
19
  cdef enum:
16
20
  CERT_KEY_SPEC_PROP_ID
21
+ CERT_SHA1_HASH_PROP_ID
17
22
 
18
23
  # Type defined at https://docs.microsoft.com/en-us/windows/win32/seccrypto/alg-id
19
24
  ctypedef unsigned int ALG_ID
@@ -68,3 +73,11 @@ cdef extern from "<wincrypt.h>" nogil:
68
73
  # Function defined at
69
74
  # https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certfreecertificatecontext
70
75
  windows.BOOL CertFreeCertificateContext(CERT_CONTEXT*)
76
+
77
+ # Function defined at
78
+ # https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certduplicatecertificatecontext
79
+ const CERT_CONTEXT* CertDuplicateCertificateContext(const CERT_CONTEXT*)
80
+
81
+ # Function defined at
82
+ # https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certverifytimevalidity
83
+ windows.LONG CertVerifyTimeValidity(windows.FILETIME*, CERT_INFO*)
@@ -1,7 +0,0 @@
1
- # Copyright © 2021. Cloud Software Group, Inc.
2
- # This file is subject to the license terms contained
3
- # in the license file that is distributed with this file.
4
-
5
- """User visible utility functions."""
6
-
7
- from spotfire.public import copy_metadata, get_spotfire_types, set_spotfire_types, set_geocoding_table
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes