PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
kcenon::pacs::security Namespace Reference

Namespaces

namespace  Action
 specific actions that can be performed
 
namespace  atna_event_ids
 
namespace  atna_event_types
 
namespace  atna_object_id_types
 
namespace  atna_role_ids
 
namespace  hipaa_identifiers
 HIPAA Safe Harbor identifiers (18 categories)
 

Classes

class  access_control_manager
 Manages permissions and access checks. More...
 
struct  AccessCheckResult
 Result of an access check. More...
 
struct  anonymization_report
 Report generated after anonymization. More...
 
class  anonymizer
 
struct  atna_active_participant
 An active participant in the audit event. More...
 
class  atna_audit_logger
 RFC 3881 XML audit message generator. More...
 
struct  atna_audit_message
 Complete RFC 3881 audit message. More...
 
struct  atna_audit_source
 Identifies the audit source system. More...
 
struct  atna_coded_value
 A coded value with code, code system name, and display name. More...
 
struct  atna_config
 Configuration for ATNA audit logging. More...
 
struct  atna_config_validation
 Validation result for ATNA configuration. More...
 
struct  atna_object_detail
 Additional detail about a participant object. More...
 
struct  atna_participant_object
 An object (patient, study, query) involved in the event. More...
 
class  atna_service_auditor
 High-level facade for emitting ATNA audit events from DICOM services. More...
 
class  atna_syslog_transport
 Sends ATNA audit messages via Syslog protocol. More...
 
class  certificate
 
class  certificate_chain
 Represents a certificate chain for validation. More...
 
struct  certificate_constraints
 Certificate validation constraints. More...
 
class  certificate_impl
 
struct  cipher_suite_spec
 TLS cipher suite specification. More...
 
class  digital_signature
 
struct  Permission
 Represents a permission grant. More...
 
class  private_key
 
class  private_key_impl
 
class  security_storage_interface
 Abstract interface for persisting security data (Users, Roles) More...
 
struct  signature_info
 Information about a digital signature. More...
 
struct  syslog_transport_config
 Configuration for the Syslog transport. More...
 
struct  tag_action_config
 Configuration for a custom tag action. More...
 
struct  tag_action_record
 Record of an action performed on a tag. More...
 
class  tls_policy
 TLS security policy configuration. More...
 
class  uid_mapping
 
struct  User
 Represents a user in the system. More...
 
class  user_context
 Represents the security context for a user session. More...
 

Typedefs

using AccessAuditCallback
 Callback for audit logging of access attempts.
 

Enumerations

enum class  DicomOperation {
  CStore , CFind , CMove , CGet ,
  CEcho , NCreate , NSet , NGet ,
  NDelete , NAction , NEventReport
}
 DICOM operation types for permission checking. More...
 
enum class  anonymization_profile : std::uint8_t {
  basic = 0 , clean_pixel = 1 , clean_descriptions = 2 , retain_longitudinal = 3 ,
  retain_patient_characteristics = 4 , hipaa_safe_harbor = 5 , gdpr_compliant = 6
}
 DICOM de-identification profiles based on PS3.15 Annex E. More...
 
enum class  private_tag_action : std::uint8_t { keep , remove_all , remove_data }
 Action to take on private tags during anonymization. More...
 
enum class  atna_event_action : char {
  create = 'C' , read = 'R' , update = 'U' , delete_action = 'D' ,
  execute = 'E'
}
 Action that triggered the audit event. More...
 
enum class  atna_event_outcome : uint8_t { success = 0 , minor_failure = 4 , serious_failure = 8 , major_failure = 12 }
 Outcome of the audited event. More...
 
enum class  atna_network_access_type : uint8_t { machine_name = 1 , ip_address = 2 , phone_number = 3 }
 Type of network access point identifier. More...
 
enum class  atna_object_type : uint8_t { person = 1 , system_object = 2 , organization = 3 , other = 4 }
 Type of participant object. More...
 
enum class  atna_object_role : uint8_t {
  patient = 1 , location = 2 , report = 3 , resource = 4 ,
  master_file = 5 , user = 6 , list = 7 , doctor = 8 ,
  subscriber = 9 , guarantor = 10 , security_user_entity = 11 , security_user_group = 12 ,
  security_resource = 13 , security_granularity_def = 14 , provider = 15 , data_destination = 16 ,
  data_repository = 17 , schedule = 18 , customer = 19 , job = 20 ,
  job_stream = 21 , table = 22 , routing_criteria = 23 , query = 24
}
 Role of the participant object in the event. More...
 
enum class  syslog_facility : uint8_t {
  kern = 0 , user = 1 , mail = 2 , daemon = 3 ,
  auth = 4 , syslog = 5 , lpr = 6 , news = 7 ,
  uucp = 8 , cron = 9 , authpriv = 10 , ftp = 11 ,
  ntp = 12 , log_audit = 13 , log_alert = 14 , clock = 15 ,
  local0 = 16 , local1 = 17 , local2 = 18 , local3 = 19 ,
  local4 = 20 , local5 = 21 , local6 = 22 , local7 = 23
}
 Syslog facility values. More...
 
enum class  syslog_severity : uint8_t {
  emergency = 0 , alert = 1 , critical = 2 , error = 3 ,
  warning = 4 , notice = 5 , informational = 6 , debug = 7
}
 Syslog severity levels. More...
 
enum class  syslog_transport_protocol : uint8_t { udp , tls }
 Syslog transport protocol. More...
 
enum class  ResourceType {
  Study , Metadata , System , Audit ,
  User , Role , Series , Image
}
 Categories of resources requiring protection. More...
 
enum class  Role {
  Viewer , Technologist , Radiologist , Administrator ,
  System
}
 User roles in the PACS system. More...
 
enum class  signature_algorithm {
  rsa_sha256 , rsa_sha384 , rsa_sha512 , ecdsa_sha256 ,
  ecdsa_sha384
}
 Signature algorithms supported for DICOM digital signatures. More...
 
enum class  signature_status {
  valid , invalid , expired , untrusted_signer ,
  revoked , no_signature
}
 Status of signature verification. More...
 
enum class  mac_algorithm { sha256 , sha384 , sha512 }
 MAC algorithm identifiers per DICOM PS3.15. More...
 
enum class  certificate_type { x509_certificate , x509_certificate_chain }
 Certificate type for DICOM signatures. More...
 
enum class  tag_action : std::uint8_t {
  remove = 0 , empty = 1 , remove_or_empty = 2 , keep = 3 ,
  replace = 4 , replace_uid = 5 , hash = 6 , encrypt = 7 ,
  shift_date = 8
}
 Actions to perform on DICOM attributes during de-identification. More...
 
enum class  tls_profile { bcp195_basic , bcp195_non_downgrading , bcp195_extended }
 TLS policy profile levels. More...
 

Functions

constexpr auto to_string (anonymization_profile profile) noexcept -> std::string_view
 Convert profile enum to string representation.
 
auto profile_from_string (std::string_view name) -> std::optional< anonymization_profile >
 Parse profile from string.
 
atna_config make_default_atna_config ()
 Create a default ATNA configuration.
 
std::string to_json (const atna_config &config)
 Serialize an atna_config to a JSON string.
 
atna_config parse_atna_config (std::string_view json_str)
 Parse an atna_config from a JSON string.
 
atna_config_validation validate (const atna_config &config)
 Validate an ATNA configuration.
 
constexpr std::string_view to_string (Role role)
 Convert Role to string.
 
std::optional< Roleparse_role (std::string_view str)
 Parse Role from string.
 
constexpr std::string_view to_string (signature_algorithm algo)
 Convert signature_algorithm to string representation.
 
std::optional< signature_algorithmparse_signature_algorithm (std::string_view str)
 Parse signature_algorithm from string.
 
constexpr std::string_view to_string (signature_status status)
 Convert signature_status to string representation.
 
constexpr std::string_view to_dicom_uid (mac_algorithm algo)
 Convert mac_algorithm to DICOM UID string.
 
constexpr std::string_view to_dicom_term (certificate_type type)
 Convert certificate_type to DICOM defined term.
 
constexpr auto to_string (tag_action action) noexcept -> std::string_view
 Convert tag action enum to string representation.
 
std::string_view to_string (tls_profile profile) noexcept
 Convert TLS profile to string.
 
std::optional< tls_profileparse_tls_profile (std::string_view str) noexcept
 Parse TLS profile from string.
 
std::vector< tls_profileavailable_tls_profiles ()
 Get a list of all available TLS profiles.
 
X509 * get_x509_from_certificate (const certificate &cert)
 

Typedef Documentation

◆ AccessAuditCallback

Initial value:
std::function<void(const user_context &ctx, DicomOperation op,
const AccessCheckResult &result)>

Callback for audit logging of access attempts.

Definition at line 64 of file access_control_manager.h.

Enumeration Type Documentation

◆ anonymization_profile

enum class kcenon::pacs::security::anonymization_profile : std::uint8_t
strong

DICOM de-identification profiles based on PS3.15 Annex E.

Each profile defines a set of actions to be performed on specific DICOM attributes to achieve varying levels of de-identification.

Profile selection depends on:

  • Regulatory requirements (HIPAA, GDPR)
  • Use case (research, clinical trial, data sharing)
  • Need to preserve clinical utility
See also
DICOM PS3.15 Annex E Table E.1-1
Enumerator
basic 

Basic Profile - Remove direct identifiers.

Removes or empties elements that directly identify the patient:

  • Patient Name, ID, Birth Date, Address
  • Accession Number, Institution Name
  • UIDs are replaced with new values

Suitable for: Basic de-identification needs

clean_pixel 

Clean Pixel Data - Remove burned-in annotations.

Extends basic profile by processing pixel data to remove burned-in patient information in image corners.

Suitable for: Images that may contain overlay text

clean_descriptions 

Clean Descriptions - Sanitize text fields.

Extends basic profile by cleaning free-text fields that may contain identifying information:

  • Study/Series Description
  • Patient Comments
  • Additional Patient History

Suitable for: Data with descriptive fields

retain_longitudinal 

Retain Longitudinal - Preserve temporal relationships.

Maintains date relationships through date shifting rather than zeroing, allowing longitudinal studies to be linked. UIDs are consistently mapped across studies.

Suitable for: Research requiring temporal analysis

retain_patient_characteristics 

Retain Patient Characteristics.

Preserves patient demographic information needed for research while removing direct identifiers:

  • Patient Sex, Age, Size, Weight

Suitable for: Clinical research with demographics

hipaa_safe_harbor 

HIPAA Safe Harbor - 18 identifier removal.

Implements HIPAA Safe Harbor method by removing all 18 categories of identifiers specified in 45 CFR 164.514(b)(2):

  • Names, addresses, dates (except year)
  • Phone/fax numbers, email addresses
  • SSN, medical record numbers, account numbers
  • Certificate/license numbers, vehicle identifiers
  • Device identifiers, web URLs, IP addresses
  • Biometric identifiers, photos, unique codes

Suitable for: HIPAA-compliant data sharing in US

gdpr_compliant 

GDPR Compliant - European data protection.

Implements GDPR pseudonymization requirements:

  • All personal data processed per Article 4(5)
  • Maintains ability to re-identify with separate key
  • Supports data subject rights (erasure, portability)

Suitable for: European Union data processing

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/security/anonymizer.h.

Definition at line 40 of file anonymization_profile.h.

40 : std::uint8_t {
51 basic = 0,
52
61 clean_pixel = 1,
62
75
86
97
113
125};
@ clean_pixel
Clean Pixel Data - Remove burned-in annotations.
@ hipaa_safe_harbor
HIPAA Safe Harbor - 18 identifier removal.
@ gdpr_compliant
GDPR Compliant - European data protection.
@ retain_longitudinal
Retain Longitudinal - Preserve temporal relationships.
@ retain_patient_characteristics
Retain Patient Characteristics.
@ clean_descriptions
Clean Descriptions - Sanitize text fields.

◆ atna_event_action

Action that triggered the audit event.

Enumerator
create 
read 
update 
delete_action 
execute 

Definition at line 53 of file atna_audit_logger.h.

◆ atna_event_outcome

enum class kcenon::pacs::security::atna_event_outcome : uint8_t
strong

Outcome of the audited event.

Enumerator
success 
minor_failure 
serious_failure 
major_failure 

Definition at line 68 of file atna_audit_logger.h.

◆ atna_network_access_type

Type of network access point identifier.

Enumerator
machine_name 
ip_address 
phone_number 

Definition at line 82 of file atna_audit_logger.h.

◆ atna_object_role

enum class kcenon::pacs::security::atna_object_role : uint8_t
strong

Role of the participant object in the event.

Enumerator
patient 
location 
report 
resource 
master_file 
user 
list 
doctor 
subscriber 
guarantor 
security_user_entity 
security_user_group 
security_resource 
security_granularity_def 
provider 
data_destination 
data_repository 
schedule 
customer 
job 
job_stream 
table 
routing_criteria 
query 

Definition at line 105 of file atna_audit_logger.h.

105 : uint8_t {
106 patient = 1,
107 location = 2,
108 report = 3,
109 resource = 4,
110 master_file = 5,
111 user = 6,
112 list = 7,
113 doctor = 8,
114 subscriber = 9,
115 guarantor = 10,
120 provider = 15,
121 data_destination = 16,
122 data_repository = 17,
123 schedule = 18,
124 customer = 19,
125 job = 20,
126 job_stream = 21,
127 table = 22,
128 routing_criteria = 23,
129 query = 24
130};

◆ atna_object_type

enum class kcenon::pacs::security::atna_object_type : uint8_t
strong

Type of participant object.

Enumerator
person 
system_object 
organization 
other 

Definition at line 95 of file atna_audit_logger.h.

◆ certificate_type

Certificate type for DICOM signatures.

Specifies the type of certificate used in the signature.

Enumerator
x509_certificate 

X.509 certificate (most common)

x509_certificate_chain 

Full X.509 certificate chain.

Definition at line 155 of file signature_types.h.

155 {
158};
@ x509_certificate
X.509 certificate (most common)
@ x509_certificate_chain
Full X.509 certificate chain.

◆ DicomOperation

DICOM operation types for permission checking.

Enumerator
CStore 

C-STORE (storage)

CFind 

C-FIND (query)

CMove 

C-MOVE (retrieve/move)

CGet 

C-GET (retrieve)

CEcho 

C-ECHO (verification)

NCreate 

N-CREATE.

NSet 

N-SET.

NGet 

N-GET.

NDelete 

N-DELETE.

NAction 

N-ACTION.

NEventReport 

N-EVENT-REPORT.

Definition at line 32 of file access_control_manager.h.

◆ mac_algorithm

MAC algorithm identifiers per DICOM PS3.15.

These identifiers are used in the MAC Algorithm (0400,0015) attribute.

Enumerator
sha256 

SHA-256 (recommended)

sha384 

SHA-384.

sha512 

SHA-512.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/security/digital_signature.h.

Definition at line 130 of file signature_types.h.

◆ private_tag_action

enum class kcenon::pacs::security::private_tag_action : std::uint8_t
strong

Action to take on private tags during anonymization.

DICOM PS3.15 Annex E recommends removing private data elements during de-identification, as they may contain Protected Health Information (PHI) in vendor-specific formats.

See also
DICOM PS3.15 Annex E - Basic Profile
Enumerator
keep 

Preserve all private tags (default for backward compatibility)

remove_all 

Remove all private data elements and their creators.

remove_data 

Remove private data elements but keep creators (for auditing)

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/security/anonymizer.h.

Definition at line 49 of file anonymizer.h.

49 : std::uint8_t {
50 keep,
53};
@ keep
Preserve all private tags (default for backward compatibility)
@ remove_data
Remove private data elements but keep creators (for auditing)
@ remove_all
Remove all private data elements and their creators.

◆ ResourceType

Categories of resources requiring protection.

Enumerator
Study 

DICOM studies/series/instances.

Metadata 

Patient/Study metadata.

System 

System configuration and services.

Audit 

Audit logs.

User 

User management.

Role 

Role management.

Series 

DICOM Series.

Image 

DICOM Image.

Definition at line 25 of file permission.h.

25 {
26 Study,
27 Metadata,
28 System,
29 Audit,
30 User,
31 Role,
32 Series,
33 Image
34};
Role
User roles in the PACS system.
Definition role.h:25
@ Study
DICOM studies/series/instances.
@ System
System configuration and services.
@ Metadata
Patient/Study metadata.
Represents a user in the system.
Definition user.h:26

◆ Role

enum class kcenon::pacs::security::Role
strong

User roles in the PACS system.

Enumerator
Viewer 

Read-only access to studies.

Technologist 

Can upload/modify studies, but not delete.

Radiologist 

Full clinical access (includes verification)

Administrator 

User management, system config.

System 

Internal system operations.

Definition at line 25 of file role.h.

25 {
26 Viewer,
30 System
31};
@ Technologist
Can upload/modify studies, but not delete.
@ Administrator
User management, system config.
@ Radiologist
Full clinical access (includes verification)
@ Viewer
Read-only access to studies.

◆ signature_algorithm

Signature algorithms supported for DICOM digital signatures.

Per DICOM PS3.15, the following algorithms are defined:

  • RSA with SHA-256 (recommended)
  • RSA with SHA-384
  • RSA with SHA-512
  • ECDSA with SHA-256 (for smaller key sizes)
  • ECDSA with SHA-384
Enumerator
rsa_sha256 

RSA with SHA-256 (recommended for most use cases)

rsa_sha384 

RSA with SHA-384.

rsa_sha512 

RSA with SHA-512 (highest security)

ecdsa_sha256 

ECDSA with SHA-256 (compact signatures)

ecdsa_sha384 

ECDSA with SHA-384.

Examples
/home/runner/work/pacs_system/pacs_system/include/kcenon/pacs/security/digital_signature.h.

Definition at line 40 of file signature_types.h.

40 {
46};
@ rsa_sha512
RSA with SHA-512 (highest security)
@ ecdsa_sha256
ECDSA with SHA-256 (compact signatures)
@ rsa_sha256
RSA with SHA-256 (recommended for most use cases)

◆ signature_status

Status of signature verification.

Enumerator
valid 

Signature is valid and trusted.

invalid 

Signature verification failed (tampered data)

expired 

Signer certificate has expired.

untrusted_signer 

Signer certificate is not trusted.

revoked 

Signer certificate has been revoked.

no_signature 

No signature present in dataset.

Definition at line 81 of file signature_types.h.

81 {
82 valid,
83 invalid,
84 expired,
86 revoked,
88};
@ untrusted_signer
Signer certificate is not trusted.
@ no_signature
No signature present in dataset.
@ revoked
Signer certificate has been revoked.
@ invalid
Signature verification failed (tampered data)

◆ syslog_facility

enum class kcenon::pacs::security::syslog_facility : uint8_t
strong

Syslog facility values.

The audit facility is typically 10 (security/authorization) or 13 (log audit) per IHE ATNA recommendations.

Enumerator
kern 
user 
mail 
daemon 
auth 
syslog 
lpr 
news 
uucp 
cron 
authpriv 

Security/authorization (recommended for ATNA)

ftp 
ntp 
log_audit 

Log audit.

log_alert 
clock 
local0 
local1 
local2 
local3 
local4 
local5 
local6 
local7 

Definition at line 38 of file atna_syslog_transport.h.

38 : uint8_t {
39 kern = 0,
40 user = 1,
41 mail = 2,
42 daemon = 3,
43 auth = 4,
44 syslog = 5,
45 lpr = 6,
46 news = 7,
47 uucp = 8,
48 cron = 9,
49 authpriv = 10,
50 ftp = 11,
51 ntp = 12,
52 log_audit = 13,
53 log_alert = 14,
54 clock = 15,
55 local0 = 16,
56 local1 = 17,
57 local2 = 18,
58 local3 = 19,
59 local4 = 20,
60 local5 = 21,
61 local6 = 22,
62 local7 = 23
63};
@ authpriv
Security/authorization (recommended for ATNA)

◆ syslog_severity

enum class kcenon::pacs::security::syslog_severity : uint8_t
strong

Syslog severity levels.

Enumerator
emergency 
alert 
critical 
error 
warning 
notice 
informational 

Default for audit events.

debug 

Definition at line 72 of file atna_syslog_transport.h.

72 : uint8_t {
73 emergency = 0,
74 alert = 1,
75 critical = 2,
76 error = 3,
77 warning = 4,
78 notice = 5,
79 informational = 6,
80 debug = 7
81};
@ informational
Default for audit events.

◆ syslog_transport_protocol

Syslog transport protocol.

Enumerator
udp 

UDP (RFC 5426) — Fire-and-forget.

tls 

TLS over TCP (RFC 5425) — Secure.

Definition at line 90 of file atna_syslog_transport.h.

90 : uint8_t {
91 udp,
92 tls
93};
@ udp
UDP (RFC 5426) — Fire-and-forget.
@ tls
TLS over TCP (RFC 5425) — Secure.

◆ tag_action

enum class kcenon::pacs::security::tag_action : std::uint8_t
strong

Actions to perform on DICOM attributes during de-identification.

These actions correspond to the action codes defined in DICOM PS3.15 Annex E Table E.1-1.

Enumerator
remove 

D - Remove the attribute entirely.

The attribute is completely removed from the dataset.

empty 

Z - Replace with zero-length value.

The attribute is retained but its value is replaced with a zero-length (empty) value.

remove_or_empty 

X - Remove or empty based on presence.

If the attribute exists, replace with zero-length value. Equivalent to empty for present attributes.

keep 

K - Keep the attribute unchanged.

The attribute and its value are retained as-is.

replace 

C - Clean (replace with dummy value)

The attribute value is replaced with a configurable dummy value (e.g., "ANONYMOUS" for names).

replace_uid 

U - Replace UIDs with new values.

UID values are replaced with newly generated UIDs. Use UID mapping for consistent replacement across datasets.

hash 

Hash the value for research linkage.

The value is replaced with a cryptographic hash, allowing de-identified datasets to be linked without revealing the original value.

encrypt 

Encrypt the value.

The value is encrypted and can be decrypted with the appropriate key. Used for pseudonymization.

shift_date 

Shift dates by a fixed offset.

Date and time values are shifted by a consistent offset while preserving temporal relationships.

Definition at line 39 of file tag_action.h.

39 : std::uint8_t {
45 remove = 0,
46
53 empty = 1,
54
62
68 keep = 3,
69
76 replace = 4,
77
84 replace_uid = 5,
85
93 hash = 6,
94
101 encrypt = 7,
102
109 shift_date = 8
110};
@ hash
Hash the value for research linkage.
@ remove
D - Remove the attribute entirely.
@ replace_uid
U - Replace UIDs with new values.
@ shift_date
Shift dates by a fixed offset.
@ remove_or_empty
X - Remove or empty based on presence.
@ replace
C - Clean (replace with dummy value)
@ empty
Z - Replace with zero-length value.

◆ tls_profile

TLS policy profile levels.

Predefined security profiles aligned with DICOM PS3.15 and BCP 195.

Enumerator
bcp195_basic 

BCP 195 basic profile: TLS 1.2 minimum, standard cipher suites.

bcp195_non_downgrading 

BCP 195 non-downgrading profile: TLS 1.2+ with no downgrade This is the DICOM PS3.15 recommended profile.

bcp195_extended 

Extended profile: TLS 1.3 only, strictest cipher suites.

Definition at line 36 of file tls_policy.h.

36 {
39
43
46};
@ bcp195_basic
BCP 195 basic profile: TLS 1.2 minimum, standard cipher suites.
@ bcp195_non_downgrading
BCP 195 non-downgrading profile: TLS 1.2+ with no downgrade This is the DICOM PS3....
@ bcp195_extended
Extended profile: TLS 1.3 only, strictest cipher suites.

Function Documentation

◆ available_tls_profiles()

std::vector< tls_profile > kcenon::pacs::security::available_tls_profiles ( )
nodiscard

Get a list of all available TLS profiles.

Definition at line 152 of file tls_policy.cpp.

152 {
153 return {tls_profile::bcp195_basic,
154 tls_profile::bcp195_non_downgrading,
155 tls_profile::bcp195_extended};
156}

References bcp195_basic, bcp195_extended, and bcp195_non_downgrading.

◆ get_x509_from_certificate()

X509 * kcenon::pacs::security::get_x509_from_certificate ( const certificate & cert)

Definition at line 276 of file digital_signature.cpp.

276 {
277 auto* impl = cert.impl();
278 if (!impl) return nullptr;
279 // Access x509 through the impl
280 // This is a workaround - in production, expose a proper internal API
281 return reinterpret_cast<X509*>(const_cast<void*>(
282 static_cast<const void*>(impl)));
283}
auto impl() const noexcept -> const certificate_impl *
Get internal implementation (for internal use only)

References kcenon::pacs::security::certificate::impl().

Here is the call graph for this function:

◆ make_default_atna_config()

atna_config kcenon::pacs::security::make_default_atna_config ( )
nodiscard

Create a default ATNA configuration.

Returns a configuration with sensible defaults:

  • Disabled by default (must be explicitly enabled)
  • UDP transport to localhost:514
  • All event types enabled
Returns
Default atna_config

Definition at line 156 of file atna_config.cpp.

156 {
157 return atna_config{};
158}
Configuration for ATNA audit logging.
Definition atna_config.h:52

◆ parse_atna_config()

atna_config kcenon::pacs::security::parse_atna_config ( std::string_view json_str)
nodiscard

Parse an atna_config from a JSON string.

Reads a JSON configuration string and populates an atna_config struct. Fields not present in the JSON retain their default values.

Parameters
json_strJSON string to parse
Returns
Parsed atna_config, or defaults for malformed input

Definition at line 196 of file atna_config.cpp.

196 {
197 atna_config config;
198
199 // Top-level fields
200 auto enabled_val = find_json_value(json_str, "enabled");
201 if (!enabled_val.empty()) {
202 config.enabled = parse_bool(enabled_val, config.enabled);
203 }
204
205 auto source_id = find_json_value(json_str, "audit_source_id");
206 if (!source_id.empty()) {
207 config.audit_source_id = source_id;
208 }
209
210 // Event filtering
211 auto storage_val = find_json_value(json_str, "audit_storage");
212 if (!storage_val.empty()) {
213 config.audit_storage = parse_bool(storage_val, config.audit_storage);
214 }
215
216 auto query_val = find_json_value(json_str, "audit_query");
217 if (!query_val.empty()) {
218 config.audit_query = parse_bool(query_val, config.audit_query);
219 }
220
221 auto auth_val = find_json_value(json_str, "audit_authentication");
222 if (!auth_val.empty()) {
223 config.audit_authentication =
224 parse_bool(auth_val, config.audit_authentication);
225 }
226
227 auto alerts_val = find_json_value(json_str, "audit_security_alerts");
228 if (!alerts_val.empty()) {
229 config.audit_security_alerts =
230 parse_bool(alerts_val, config.audit_security_alerts);
231 }
232
233 // Transport nested object
234 auto proto = find_nested_value(json_str, "transport", "protocol");
235 if (!proto.empty()) {
236 config.transport.protocol = parse_protocol(proto);
237 }
238
239 auto host = find_nested_value(json_str, "transport", "host");
240 if (!host.empty()) {
241 config.transport.host = host;
242 }
243
244 auto port = find_nested_value(json_str, "transport", "port");
245 if (!port.empty()) {
246 config.transport.port =
247 parse_uint16(port, config.transport.port);
248 }
249
250 auto app = find_nested_value(json_str, "transport", "app_name");
251 if (!app.empty()) {
252 config.transport.app_name = app;
253 }
254
255 auto ca = find_nested_value(json_str, "transport", "ca_cert_path");
256 if (!ca.empty()) {
257 config.transport.ca_cert_path = ca;
258 }
259
260 auto cert = find_nested_value(json_str, "transport", "client_cert_path");
261 if (!cert.empty()) {
262 config.transport.client_cert_path = cert;
263 }
264
265 auto key = find_nested_value(json_str, "transport", "client_key_path");
266 if (!key.empty()) {
267 config.transport.client_key_path = key;
268 }
269
270 auto verify = find_nested_value(json_str, "transport", "verify_server");
271 if (!verify.empty()) {
272 config.transport.verify_server =
273 parse_bool(verify, config.transport.verify_server);
274 }
275
276 return config;
277}
bool audit_security_alerts
Audit security alert events (access denied, etc.)
Definition atna_config.h:74
syslog_transport_config transport
Syslog transport configuration.
Definition atna_config.h:60
bool enabled
Master enable/disable for ATNA audit logging.
Definition atna_config.h:54
bool audit_storage
Audit C-STORE events (DICOM Instances Transferred)
Definition atna_config.h:65
bool audit_query
Audit C-FIND events (Query)
Definition atna_config.h:68
bool audit_authentication
Audit login/logout events (User Authentication)
Definition atna_config.h:71
std::string audit_source_id
Audit source identifier (e.g., "PACS_SYSTEM_01")
Definition atna_config.h:57
std::string client_key_path
Path to client private key file (mutual TLS)
std::string ca_cert_path
Path to CA certificate file for server verification.
syslog_transport_protocol protocol
Transport protocol (UDP or TLS)
uint16_t port
Port number (514 for UDP, 6514 for TLS per IANA)
std::string host
Audit Record Repository hostname or IP.
std::string app_name
Application name in Syslog header.
std::string client_cert_path
Path to client certificate file (mutual TLS)
bool verify_server
Whether to verify server certificate (disable only for testing)

References kcenon::pacs::security::syslog_transport_config::app_name, kcenon::pacs::security::atna_config::audit_authentication, kcenon::pacs::security::atna_config::audit_query, kcenon::pacs::security::atna_config::audit_security_alerts, kcenon::pacs::security::atna_config::audit_source_id, kcenon::pacs::security::atna_config::audit_storage, kcenon::pacs::security::syslog_transport_config::ca_cert_path, kcenon::pacs::security::syslog_transport_config::client_cert_path, kcenon::pacs::security::syslog_transport_config::client_key_path, kcenon::pacs::security::atna_config::enabled, kcenon::pacs::security::syslog_transport_config::host, kcenon::pacs::security::syslog_transport_config::port, kcenon::pacs::security::syslog_transport_config::protocol, kcenon::pacs::security::atna_config::transport, and kcenon::pacs::security::syslog_transport_config::verify_server.

◆ parse_role()

std::optional< Role > kcenon::pacs::security::parse_role ( std::string_view str)
inline

Parse Role from string.

Definition at line 50 of file role.h.

50 {
51 if (str == "Viewer") return Role::Viewer;
52 if (str == "Technologist") return Role::Technologist;
53 if (str == "Radiologist") return Role::Radiologist;
54 if (str == "Administrator") return Role::Administrator;
55 if (str == "System") return Role::System;
56 return std::nullopt;
57}

References Administrator, Radiologist, System, Technologist, and Viewer.

Referenced by kcenon::pacs::web::endpoints::register_security_endpoints_impl().

Here is the caller graph for this function:

◆ parse_signature_algorithm()

std::optional< signature_algorithm > kcenon::pacs::security::parse_signature_algorithm ( std::string_view str)
inline

Parse signature_algorithm from string.

Parameters
strThe string to parse
Returns
Optional containing the algorithm, or nullopt if parsing fails

Definition at line 69 of file signature_types.h.

69 {
70 if (str == "RSA-SHA256") return signature_algorithm::rsa_sha256;
71 if (str == "RSA-SHA384") return signature_algorithm::rsa_sha384;
72 if (str == "RSA-SHA512") return signature_algorithm::rsa_sha512;
73 if (str == "ECDSA-SHA256") return signature_algorithm::ecdsa_sha256;
74 if (str == "ECDSA-SHA384") return signature_algorithm::ecdsa_sha384;
75 return std::nullopt;
76}

References ecdsa_sha256, ecdsa_sha384, rsa_sha256, rsa_sha384, and rsa_sha512.

◆ parse_tls_profile()

std::optional< tls_profile > kcenon::pacs::security::parse_tls_profile ( std::string_view str)
nodiscardnoexcept

Parse TLS profile from string.

Definition at line 25 of file tls_policy.cpp.

25 {
26 if (str == "BCP195-Basic" || str == "basic")
27 return tls_profile::bcp195_basic;
28 if (str == "BCP195-NonDowngrading" || str == "non-downgrading")
29 return tls_profile::bcp195_non_downgrading;
30 if (str == "BCP195-Extended" || str == "extended")
31 return tls_profile::bcp195_extended;
32 return std::nullopt;
33}

References bcp195_basic, bcp195_extended, and bcp195_non_downgrading.

◆ profile_from_string()

auto kcenon::pacs::security::profile_from_string ( std::string_view name) -> std::optional<anonymization_profile>
inlinenodiscard

Parse profile from string.

Parameters
nameString name of the profile
Returns
Optional containing the profile, or nullopt if invalid
Examples
dcm_anonymize/main.cpp.

Definition at line 158 of file anonymization_profile.h.

159 {
160 if (name == "basic") return anonymization_profile::basic;
161 if (name == "clean_pixel") return anonymization_profile::clean_pixel;
162 if (name == "clean_descriptions") return anonymization_profile::clean_descriptions;
163 if (name == "retain_longitudinal") return anonymization_profile::retain_longitudinal;
164 if (name == "retain_patient_characteristics") {
165 return anonymization_profile::retain_patient_characteristics;
166 }
167 if (name == "hipaa_safe_harbor") return anonymization_profile::hipaa_safe_harbor;
168 if (name == "gdpr_compliant") return anonymization_profile::gdpr_compliant;
169 return std::nullopt;
170}
std::string_view name

References basic, clean_descriptions, clean_pixel, gdpr_compliant, hipaa_safe_harbor, name, retain_longitudinal, and retain_patient_characteristics.

◆ to_dicom_term()

std::string_view kcenon::pacs::security::to_dicom_term ( certificate_type type)
constexpr

Convert certificate_type to DICOM defined term.

Parameters
typeThe certificate type
Returns
DICOM defined term

Definition at line 165 of file signature_types.h.

165 {
166 switch (type) {
167 case certificate_type::x509_certificate: return "X509_1993_SIG";
168 case certificate_type::x509_certificate_chain: return "X509_1993_SIG_CHAIN";
169 }
170 return "";
171}

References x509_certificate, and x509_certificate_chain.

◆ to_dicom_uid()

std::string_view kcenon::pacs::security::to_dicom_uid ( mac_algorithm algo)
constexpr

Convert mac_algorithm to DICOM UID string.

Parameters
algoThe MAC algorithm
Returns
DICOM defined term for the algorithm

Definition at line 141 of file signature_types.h.

141 {
142 switch (algo) {
143 case mac_algorithm::sha256: return "2.16.840.1.101.3.4.2.1";
144 case mac_algorithm::sha384: return "2.16.840.1.101.3.4.2.2";
145 case mac_algorithm::sha512: return "2.16.840.1.101.3.4.2.3";
146 }
147 return "";
148}

References sha256, sha384, and sha512.

Referenced by kcenon::pacs::security::digital_signature::sign_tags().

Here is the caller graph for this function:

◆ to_json()

std::string kcenon::pacs::security::to_json ( const atna_config & config)
nodiscard

Serialize an atna_config to a JSON string.

Produces a compact JSON representation suitable for configuration files and REST API responses.

Parameters
configThe configuration to serialize
Returns
JSON string

Definition at line 164 of file atna_config.cpp.

164 {
165 std::ostringstream oss;
166 oss << R"({"enabled":)" << (config.enabled ? "true" : "false")
167 << R"(,"audit_source_id":")" << escape_json(config.audit_source_id)
168 << R"(","transport":{"protocol":")"
169 << protocol_to_string(config.transport.protocol)
170 << R"(","host":")" << escape_json(config.transport.host)
171 << R"(","port":)" << config.transport.port
172 << R"(,"app_name":")" << escape_json(config.transport.app_name)
173 << R"(","ca_cert_path":")" << escape_json(config.transport.ca_cert_path)
174 << R"(","client_cert_path":")"
175 << escape_json(config.transport.client_cert_path)
176 << R"(","client_key_path":")"
177 << escape_json(config.transport.client_key_path)
178 << R"(","verify_server":)"
179 << (config.transport.verify_server ? "true" : "false")
180 << R"(},"audit_storage":)"
181 << (config.audit_storage ? "true" : "false")
182 << R"(,"audit_query":)"
183 << (config.audit_query ? "true" : "false")
184 << R"(,"audit_authentication":)"
185 << (config.audit_authentication ? "true" : "false")
186 << R"(,"audit_security_alerts":)"
187 << (config.audit_security_alerts ? "true" : "false")
188 << "}";
189 return oss.str();
190}

References kcenon::pacs::security::syslog_transport_config::app_name, kcenon::pacs::security::atna_config::audit_authentication, kcenon::pacs::security::atna_config::audit_query, kcenon::pacs::security::atna_config::audit_security_alerts, kcenon::pacs::security::atna_config::audit_source_id, kcenon::pacs::security::atna_config::audit_storage, kcenon::pacs::security::syslog_transport_config::ca_cert_path, kcenon::pacs::security::syslog_transport_config::client_cert_path, kcenon::pacs::security::syslog_transport_config::client_key_path, kcenon::pacs::security::atna_config::enabled, kcenon::pacs::security::syslog_transport_config::host, kcenon::pacs::security::syslog_transport_config::port, kcenon::pacs::security::syslog_transport_config::protocol, kcenon::pacs::security::atna_config::transport, and kcenon::pacs::security::syslog_transport_config::verify_server.

◆ to_string() [1/6]

auto kcenon::pacs::security::to_string ( anonymization_profile profile) -> std::string_view
nodiscardconstexprnoexcept

Convert profile enum to string representation.

Parameters
profileThe anonymization profile
Returns
String name of the profile

Definition at line 132 of file anonymization_profile.h.

133 {
134 switch (profile) {
135 case anonymization_profile::basic:
136 return "basic";
137 case anonymization_profile::clean_pixel:
138 return "clean_pixel";
139 case anonymization_profile::clean_descriptions:
140 return "clean_descriptions";
141 case anonymization_profile::retain_longitudinal:
142 return "retain_longitudinal";
143 case anonymization_profile::retain_patient_characteristics:
144 return "retain_patient_characteristics";
145 case anonymization_profile::hipaa_safe_harbor:
146 return "hipaa_safe_harbor";
147 case anonymization_profile::gdpr_compliant:
148 return "gdpr_compliant";
149 }
150 return "unknown";
151}

References basic, clean_descriptions, clean_pixel, gdpr_compliant, hipaa_safe_harbor, retain_longitudinal, and retain_patient_characteristics.

Referenced by kcenon::pacs::security::anonymizer::anonymize_with_mapping(), and kcenon::pacs::security::tls_policy::profile_name().

Here is the caller graph for this function:

◆ to_string() [2/6]

std::string_view kcenon::pacs::security::to_string ( Role role)
constexpr

Convert Role to string.

Definition at line 36 of file role.h.

36 {
37 switch (role) {
38 case Role::Viewer: return "Viewer";
39 case Role::Technologist: return "Technologist";
40 case Role::Radiologist: return "Radiologist";
41 case Role::Administrator: return "Administrator";
42 case Role::System: return "System";
43 }
44 return "Unknown";
45}

References Administrator, Radiologist, System, Technologist, and Viewer.

◆ to_string() [3/6]

std::string_view kcenon::pacs::security::to_string ( signature_algorithm algo)
constexpr

Convert signature_algorithm to string representation.

Parameters
algoThe algorithm to convert
Returns
String representation of the algorithm

Definition at line 53 of file signature_types.h.

53 {
54 switch (algo) {
55 case signature_algorithm::rsa_sha256: return "RSA-SHA256";
56 case signature_algorithm::rsa_sha384: return "RSA-SHA384";
57 case signature_algorithm::rsa_sha512: return "RSA-SHA512";
58 case signature_algorithm::ecdsa_sha256: return "ECDSA-SHA256";
59 case signature_algorithm::ecdsa_sha384: return "ECDSA-SHA384";
60 }
61 return "Unknown";
62}

References ecdsa_sha256, ecdsa_sha384, rsa_sha256, rsa_sha384, and rsa_sha512.

◆ to_string() [4/6]

std::string_view kcenon::pacs::security::to_string ( signature_status status)
constexpr

Convert signature_status to string representation.

Parameters
statusThe status to convert
Returns
String representation of the status

Definition at line 95 of file signature_types.h.

95 {
96 switch (status) {
97 case signature_status::valid: return "Valid";
98 case signature_status::invalid: return "Invalid";
99 case signature_status::expired: return "Expired";
100 case signature_status::untrusted_signer: return "UntrustedSigner";
101 case signature_status::revoked: return "Revoked";
102 case signature_status::no_signature: return "NoSignature";
103 }
104 return "Unknown";
105}

References expired, invalid, no_signature, revoked, untrusted_signer, and valid.

◆ to_string() [5/6]

auto kcenon::pacs::security::to_string ( tag_action action) -> std::string_view
nodiscardconstexprnoexcept

Convert tag action enum to string representation.

Parameters
actionThe tag action
Returns
String name of the action

Definition at line 117 of file tag_action.h.

118 {
119 switch (action) {
120 case tag_action::remove:
121 return "remove";
122 case tag_action::empty:
123 return "empty";
124 case tag_action::remove_or_empty:
125 return "remove_or_empty";
126 case tag_action::keep:
127 return "keep";
128 case tag_action::replace:
129 return "replace";
130 case tag_action::replace_uid:
131 return "replace_uid";
132 case tag_action::hash:
133 return "hash";
134 case tag_action::encrypt:
135 return "encrypt";
136 case tag_action::shift_date:
137 return "shift_date";
138 }
139 return "unknown";
140}

References empty, encrypt, hash, keep, remove, remove_or_empty, replace, replace_uid, and shift_date.

◆ to_string() [6/6]

std::string_view kcenon::pacs::security::to_string ( tls_profile profile)
nodiscardnoexcept

Convert TLS profile to string.

Definition at line 13 of file tls_policy.cpp.

13 {
14 switch (profile) {
15 case tls_profile::bcp195_basic:
16 return "BCP195-Basic";
17 case tls_profile::bcp195_non_downgrading:
18 return "BCP195-NonDowngrading";
19 case tls_profile::bcp195_extended:
20 return "BCP195-Extended";
21 }
22 return "Unknown";
23}

References bcp195_basic, bcp195_extended, and bcp195_non_downgrading.

◆ validate()

atna_config_validation kcenon::pacs::security::validate ( const atna_config & config)
nodiscard

Validate an ATNA configuration.

Checks for:

  • Non-empty audit_source_id
  • Non-empty transport host
  • Valid port range (1-65535)
  • TLS certificate paths exist when protocol is TLS
Parameters
configThe configuration to validate
Returns
Validation result with any errors

Definition at line 283 of file atna_config.cpp.

283 {
285
286 if (config.audit_source_id.empty()) {
287 result.valid = false;
288 result.errors.emplace_back("audit_source_id must not be empty");
289 }
290
291 if (config.transport.host.empty()) {
292 result.valid = false;
293 result.errors.emplace_back("transport.host must not be empty");
294 }
295
296 if (config.transport.port == 0) {
297 result.valid = false;
298 result.errors.emplace_back(
299 "transport.port must be in range 1-65535");
300 }
301
302 if (config.transport.protocol == syslog_transport_protocol::tls) {
303 if (config.transport.ca_cert_path.empty()) {
304 result.valid = false;
305 result.errors.emplace_back(
306 "transport.ca_cert_path is required for TLS protocol");
307 } else if (!std::filesystem::exists(
308 config.transport.ca_cert_path)) {
309 result.valid = false;
310 result.errors.emplace_back(
311 "transport.ca_cert_path file does not exist: " +
312 config.transport.ca_cert_path);
313 }
314
315 if (!config.transport.client_cert_path.empty() &&
316 !std::filesystem::exists(config.transport.client_cert_path)) {
317 result.valid = false;
318 result.errors.emplace_back(
319 "transport.client_cert_path file does not exist: " +
321 }
322
323 if (!config.transport.client_key_path.empty() &&
324 !std::filesystem::exists(config.transport.client_key_path)) {
325 result.valid = false;
326 result.errors.emplace_back(
327 "transport.client_key_path file does not exist: " +
329 }
330 }
331
332 return result;
333}
Validation result for ATNA configuration.

References kcenon::pacs::security::atna_config::audit_source_id, kcenon::pacs::security::syslog_transport_config::ca_cert_path, kcenon::pacs::security::syslog_transport_config::client_cert_path, kcenon::pacs::security::syslog_transport_config::client_key_path, kcenon::pacs::security::atna_config_validation::errors, kcenon::pacs::security::syslog_transport_config::host, kcenon::pacs::security::syslog_transport_config::port, kcenon::pacs::security::syslog_transport_config::protocol, tls, kcenon::pacs::security::atna_config::transport, and kcenon::pacs::security::atna_config_validation::valid.