Skip to content

Commit

Permalink
Version 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Gematik-Entwicklung committed Aug 11, 2022
1 parent 71cbbcb commit f471891
Show file tree
Hide file tree
Showing 44 changed files with 1,413 additions and 220 deletions.
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ github "SwiftCommon/DataKit" "1.1.0"
github "gematik/OpenSSL-Swift" "3.0.3"
github "hectr/swift-stream-reader" "0.3.0"
github "swiftsocket/SwiftSocket" "2e6ba27140a29fae8a6331ba4463312e0c71a6b0"
github "tadija/AEXML" "4.5.0"
github "tadija/AEXML" "4.5.0"
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,4 @@ RUBY VERSION
ruby 2.6.5p114

BUNDLED WITH
2.3.13
2.3.16
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
//
// Copyright (c) 2022 gematik GmbH
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import HealthCardAccess
@testable import HealthCardControl
import Nimble
import XCTest

final class HealthCardTypeExtResetRetryCounterIntegrationTest: CardSimulationTerminalTestCase {
override class var configFileInput: String {
"Configuration/configuration_EGK_G2_1_80276883110000095711_GuD_TCP.xml"
}

override class var healthCardStatusInput: HealthCardStatus { .valid(cardType: .egk(generation: .g2_1)) }

func testResetRetryCounterEgk21_success() throws {
let puk = "12345678" as Format2Pin

expect(
try Self.healthCard.resetRetryCounter(
puk: puk,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.success
}

func testResetRetryCounterWithNewPinEgk21_success() throws {
let puk = "12345678" as Format2Pin
let newPin = "654321" as Format2Pin

expect(
try Self.healthCard.resetRetryCounterAndSetNewPin(
puk: puk,
newPin: newPin,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.success
}

func testResetRetryCounterWithNewPinEgk21_wrongPasswordLength() throws {
let puk = "12345678" as Format2Pin
let tooLongNewPin = "654112341234" as Format2Pin

expect(
try Self.healthCard.resetRetryCounterAndSetNewPin(
puk: puk,
newPin: tooLongNewPin,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.wrongPasswordLength
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//
// Copyright (c) 2022 gematik GmbH
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an 'AS IS' BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import Foundation
import HealthCardAccess
@testable import HealthCardControl
import Nimble
import XCTest

// Note: This continuation of `HealthCardTypeExtResetRetryCounterIntegrationTest` exists to separate the count dependent
// tests from the other ones.
final class HealthCardTypeExtResetRetryCounterIntegrationTestCont: CardSimulationTerminalTestCase {
override class var configFileInput: String {
"Configuration/configuration_EGK_G2_1_80276883110000095711_GuD_TCP.xml"
}

override class var healthCardStatusInput: HealthCardStatus { .valid(cardType: .egk(generation: .g2_1)) }

func testResetRetryCounterEgk21_wrongSecretWarning() throws {
let wrongPuk = "9999999" as Format2Pin
let newPin = "654321" as Format2Pin

// With setting a new PIN
expect(
try Self.healthCard.resetRetryCounterAndSetNewPin(
puk: wrongPuk,
newPin: newPin,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.wrongSecretWarning(retryCount: 9)

expect(
try Self.healthCard.resetRetryCounterAndSetNewPin(
puk: wrongPuk,
newPin: newPin,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.wrongSecretWarning(retryCount: 8)

// Without setting a new PIN
expect(
try Self.healthCard.resetRetryCounter(
puk: wrongPuk,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.wrongSecretWarning(retryCount: 7)

expect(
try Self.healthCard.resetRetryCounter(
puk: wrongPuk,
type: EgkFileSystem.Pin.mrpinHome,
dfSpecific: false
)
.test()
) == ResetRetryCounterResponse.wrongSecretWarning(retryCount: 6)
}
}
Loading

0 comments on commit f471891

Please sign in to comment.