Manual/CryptokiMan

[CryptokiMan] SoftHSM ๋ชจ๋“ˆ ์ดˆ๊ธฐํ™” ํ•˜๊ธฐ

JayKim๐Ÿ™‚ 2023. 5. 16. 16:00

[์ด ๊ธฐ๋Šฅ์€ ๋ผ์ด์„ ์Šค ๋ฒ„์ „ ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค]
๋ผ์ด์„ ์Šค๊ฐ€ ํ•„์š”ํ•œ ๋ถ„์€ [ํ”„๋กœ๊ทธ๋žจ ํ‚ค ๋ฐœ๊ธ‰] ํŽ˜์ด์ง€์—์„œ 30์ผ ๋ผ์ด์„ ์Šค ๋ฐœ๊ธ‰ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค

SoftHSM ์ฒ˜์Œ ์„ค์น˜ ํ•˜๋ฉด ์ดˆ๊ธฐ ์…‹ํŒ…์ด ํ•„์š”ํ•˜๋‹ค.
์ด๋ฒˆ์—๋Š” softhsm2-util ์„ ์ด์šฉํ•ด์„œ๊ฐ€ ์•„๋‹ˆ๋ผ CryptokiMan ์„ ์ด์šฉํ•ด์„œ ์ดˆ๊ธฐํ™”๋ฅผ ํ•ด๋ณด์ž

์ดˆ๊ธฐ ์…‹ํŒ…์„ ์œ„ํ•ด SoftHSM ์—์„œ ์ œ๊ณตํ•˜๋Š” Cryptoki Library ์˜ PKCS#11 API๋ฅผ CryptokiMan ์—์„œ ์‚ฌ์šฉํ•ด ์ดˆ๊ธฐํ™”๋ฅผ ํ•œ๋‹ค.

SoftHSM ์ฒ˜์Œ ์„ค์น˜๋Š” ์˜คํ”ˆ์†Œ์Šค SoftHSM ์‚ฌ์šฉ๋ฒ• ( Windows ํ™˜๊ฒฝ ) ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์ž
ํ•ด๋‹น ๋ฌธ์„œ์—์„œ SoftHSM ์ฒ˜์Œ ์ƒํƒœ ํ™•์ธ ๊นŒ์ง€๋งŒ ์ง„ํ–‰์„ ํ•˜์ž

์ด๋ฒˆ์—๋Š” SoftHSM ์ฒ˜์Œ ์„ค์น˜๋ฅผ ํ•˜๊ณ  ์ƒํƒœํ™•์ธ์„ ํ•ด๋ณด๋ฉด ๋‹ค์Œ ์ฒ˜๋Ÿผ ๋‚˜์˜จ๋‹ค.

softhsm2-util.exe --show-slots

Available slots:
Slot 0
    Slot info:
        Description:      SoftHSM slot ID 0x0
        Manufacturer ID:  SoftHSM project
        Hardware version: 2.5
        Firmware version: 2.5
        Token present:    yes
    Token info:
        Manufacturer ID:  SoftHSM project
        Model:            SoftHSM v2
        Hardware version: 2.5
        Firmware version: 2.5
        Serial number:
        Initialized:      no
        User PIN init.:   no
        Label:

์ด๋ ‡๊ฒŒ ๋‚˜์˜จ๋‹ค.

ํ† ํฐ ์ดˆ๊ธฐํ™”

ํ† ์ปจ ์ดˆ๊ธฐํ™”๋Š” HSM ํ† ์ปจ ๋ผ๋ฒจ ์„ค์ •๊ณผ SO ์— ๋Œ€ํ•œ PIN ๊ฐ’์„ ์„ค์ • ํ•œ๋‹ค.

ํ† ์ปจ ์ดˆ๊ธฐํ™”๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” cryptoki library ๋ฅผ ๋กœ๋“œ ํ•œํ›„ C_Initialize ๋ฅผ ํ•ด์•ผ ํ•œ๋‹ค.
CrytokiMan์—์„œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ ํƒ ํ›„ P11 Initialize ๋ฅผ ๋จผ์ € ์‹คํ–‰ ํ•œ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ์Šฌ๋กฏ ์„ ํƒ ํ›„ ๋„๊ตฌ->ํ† ํฐ ์ดˆ๊ธฐํ™” ๋ฅผ ์„ ํƒํ•˜๋ฉด ๋‹ค์Œ ํ™”๋ฉด์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

๋ผ๋ฒจ์ด๋ž‘ PIN ๊ฐ’์„ ์ž…๋ ฅ ํ•˜๊ณ  OK ๋ฅผ ์‹คํ–‰ ํ•˜๋ฉด C_InitToken ์ด ์‹คํ–‰ ๋œ๋‹ค.

PIN ์ดˆ๊ธฐํ™”

PIN ์ดˆ๊ธฐํ™” ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ† ์ปจ ์ดˆ๊ธฐํ™” ๋•Œ ์„ค์ •ํ•œ SO PIN ์œผ๋กœ ๋กœ๊ทธ์ธ ํ›„ ์‹คํ–‰ ํ•ด์•ผ ํ•œ๋‹ค.
๋กœ๊ทธ์ธ ๋ฐฉ๋ฒ•์€ [CryptokiMan] Cryptoki ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ• ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐ ํ•˜์ž.

SO ๋กœ๊ทธ์ธ์„ ํ•˜๊ณ  ๋‚˜๋ฉด ์•„๋ž˜ ํ™”๋ฉด ์ฒ˜๋Ÿผ ๋กœ๊ทธ์ธ ์ƒํƒœ๊ฐ€ YES ๋กœ ๋‚˜์˜จ๋‹ค.

์—ฌ๊ธฐ์„œ ์ž…๋ ฅ ํ•˜๋Š” PIN ๋ฒˆํ˜ธ๋Š” User ์˜ ํ•€ ๋ฒˆํ˜ธ ๊ฐ’์ด๋‹ค.
์ด๋ ‡๊ฒŒ ์„ค์ •์„ ํ•˜๊ณ  OK ๋ฅผ ๋ˆ„๋ฅด๋ฉด User์˜ PIN ์„ค์ •์ด ์™„๋ฃŒ ๋œ๋‹ค.

User PIN ์ด ์„ค์ •์ด ๋˜๋ฉด ์ดˆ๊ธฐ ์„ค์ •์ด ์™„๋ฃŒ ๋œ๊ฒƒ์ด๋‹ค.

์ดˆ๊ธฐํ™” ํ›„ ํ™•์ธ

๊ทธ๋Ÿผ softhsm2-util.exe --show-slots ๋กœ ํ™•์ธ ํ•ด๋ณด์ž

Available slots:
Slot 1072931930
    Slot info:
        Description:      SoftHSM slot ID 0x3ff3a45a
        Manufacturer ID:  SoftHSM project
        Hardware version: 2.5
        Firmware version: 2.5
        Token present:    yes
    Token info:
        Manufacturer ID:  SoftHSM project
        Model:            SoftHSM v2
        Hardware version: 2.5
        Firmware version: 2.5
        Serial number:    f12c731fbff3a45a
        Initialized:      yes
        User PIN init.:   yes
        Label:            Test Slot0 label
Slot 1
    Slot info:
        Description:      SoftHSM slot ID 0x1
        Manufacturer ID:  SoftHSM project
        Hardware version: 2.5
        Firmware version: 2.5
        Token present:    yes
    Token info:
        Manufacturer ID:  SoftHSM project
        Model:            SoftHSM v2
        Hardware version: 2.5
        Firmware version: 2.5
        Serial number:
        Initialized:      no
        User PIN init.:   no
        Label:

์ด๋ ‡๊ฒŒ slot0 ์— ์ •๋ณด๊ฐ€ ๋‚˜์˜จ๋‹ค.

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด HSM ์ดˆ๊ธฐํ™”๊ฐ€ ์™„๋ฃŒ ๋˜์—ˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ  ์‚ฌ์šฉ์ž๋กœ ๋กœ๊ทธ์ธ ํ•ด์„œ HSM ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

๋ฐ˜์‘ํ˜•