Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FIT-Connect-SDK - .NET
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FIT-Connect
FIT-Connect-SDK - .NET
Commits
a363bec4
Commit
a363bec4
authored
2 years ago
by
Klaus Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Implemented 5.4
parent
e8e7b923
No related branches found
No related tags found
1 merge request
!24
AutoReject planning#594
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
FitConnect/Services/Models/v1/Api/Problems.cs
+2
-1
2 additions, 1 deletion
FitConnect/Services/Models/v1/Api/Problems.cs
FitConnect/Subscriber.cs
+26
-13
26 additions, 13 deletions
FitConnect/Subscriber.cs
with
28 additions
and
14 deletions
FitConnect/Services/Models/v1/Api/Problems.cs
+
2
−
1
View file @
a363bec4
...
...
@@ -25,7 +25,8 @@ public class Problems {
public
const
string
DetailMissingData
=
"Der Fachdatensatz fehlt."
;
public
const
string
TitleHashMismatch
=
"Prüfsumme stimmt nicht"
;
public
const
string
DetailDataHashMismatch
=
"Die Prüfsumme des Fachdatensatzes stimmt nicht."
;
public
const
string
DetailHashMismatchData
=
"Die Prüfsumme des Fachdatensatzes stimmt nicht."
;
public
const
string
DetailHashMismatchAttachment
=
"Der Hash der Anlage {0} stimmt nicht."
;
public
const
string
TitleMissingSchema
=
"Schema-Referenz fehlt"
;
public
const
string
DetailMissingSchema
=
"Die Schema-Referenz fehlt im Metadatensatz."
;
...
...
This diff is collapsed.
Click to expand it.
FitConnect/Subscriber.cs
+
26
−
13
View file @
a363bec4
...
...
@@ -283,7 +283,7 @@ public class Subscriber : FitConnectClient,
// SuccessCriteria: 4.3
var
problem
=
new
Problems
(
Problems
.
ProblemTypeEnum
.
HashMismatch
,
Problems
.
TitleHashMismatch
,
detail
:
Problems
.
Detail
Data
HashMismatch
,
Problems
.
ProblemInstanceEnum
.
Data
);
detail
:
Problems
.
DetailHashMismatch
Data
,
Problems
.
ProblemInstanceEnum
.
Data
);
RejectSubmission
(
submission
,
Problems
.
EncryptionIssue
);
throw
new
SecurityEventException
(
problem
);
}
...
...
@@ -339,7 +339,7 @@ public class Subscriber : FitConnectClient,
if
(
submission
.
EncryptedData
?.
Split
(
'.'
).
Last
()
!=
dataSignature
)
{
// SuccessCriteria: 4.1
var
problem
=
new
Problems
(
Problems
.
ProblemTypeEnum
.
IncorrectAuthenticationTag
,
Problems
.
Detail
Data
HashMismatch
);
Problems
.
DetailHashMismatch
Data
);
RejectSubmission
(
submission
,
problem
);
throw
new
SecurityEventException
(
problem
);
}
...
...
@@ -420,16 +420,10 @@ public class Subscriber : FitConnectClient,
throw
new
SecurityEventException
(
problem
,
e
);
}
byte
[]?
content
;
byte
[]?
hash
;
try
{
var
(
_
,
content
,
hash
)
=
Encryption
.
Decrypt
(
encryptedAttachment
);
var
attachmentMeta
=
submission
.
Metadata
?.
ContentStructure
.
Attachments
.
First
(
a
=>
a
.
AttachmentId
==
id
);
if
(
attachmentMeta
!=
null
)
attachments
.
Add
(
new
Attachment
(
id
,
attachmentMeta
,
content
,
encryptedAttachment
.
Split
(
'.'
).
Last
()));
(
_
,
content
,
hash
)
=
Encryption
.
Decrypt
(
encryptedAttachment
);
}
catch
(
Exception
e
)
{
var
problem
=
new
Problems
(
...
...
@@ -437,11 +431,30 @@ public class Subscriber : FitConnectClient,
Problems
.
TitleEncryptionIssue
,
string
.
Format
(
Problems
.
DetailEncryptionIssueAttachment
,
id
),
"attachment:{id}"
);
);
RejectSubmission
(
submission
,
problem
);
throw
new
SecurityEventException
(
problem
,
e
);
}
var
attachmentMeta
=
submission
.
Metadata
?.
ContentStructure
.
Attachments
.
First
(
a
=>
a
.
AttachmentId
==
id
);
if
(
attachmentMeta
!=
null
)
attachments
.
Add
(
new
Attachment
(
id
,
attachmentMeta
,
content
,
encryptedAttachment
.
Split
(
'.'
).
Last
()));
// SuccessCriteria: Hash-Check 5.4
if
(
attachmentMeta
?.
Hash
.
Content
!=
FitEncryption
.
CalculateHash
(
content
))
{
var
problem
=
new
Problems
(
Problems
.
ProblemTypeEnum
.
HashMismatch
,
Problems
.
TitleHashMismatch
,
string
.
Format
(
Problems
.
DetailHashMismatchAttachment
,
id
),
"attachment:{id}"
);
RejectSubmission
(
submission
,
problem
);
throw
new
SecurityEventException
(
problem
);
}
}
return
attachments
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment