Source Code 13

PKCS#11 Header ํŒŒ์ผ ์ ์šฉ ํ•˜๊ธฐ

PKCS#11 ํ‘œ์ค€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ธ Cryptoki ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” OASIS ์—์„œ ์ œ๊ณตํ•˜๋Š” ํ—ค๋” ํŒŒ์ผ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค. PKCS#11์€ ๋ชจ๋“  ์ •์˜ ๊ฐ’์ด ํ‘œ์ค€ํ™” ๋˜์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์ด์— ๋Œ€ํ•œ ์ •์˜๋ฅผ OASIS์—์„œ ๋งŒ๋“ค์–ด์„œ ์ œ๊ณต ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค. ๊ทธ๋Ÿผ ์ œ๊ณต ํ•˜๋Š” Header ํŒŒ์ผ์€ ๋‹ค์Œ 3๊ฐ€์ง€ ์ด๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” ํ˜„์žฌ ๊ฐ€์žฅ ๋งŽ์ด ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๋‹ค๊ณ  ์ƒ๊ฐ ๋˜๋Š” PKCS#11 ๋ฒ„์ „ 2.4 ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์„ค๋ช…ํ•œ๋‹ค. ์•„๋ž˜ ์ฃผ์†Œ๋กœ ๊ฐ€๋ฉด ๊ด€๋ จ ๋‚ด์šฉ์„ ์ฐธ์กฐ ํ•  ์ˆ˜ ์žˆ๋‹ค. http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html PKCS #11 Cryptographic Token Interface Base Specificatio..

[OpenSSL3] OpenSSL ์ปดํŒŒ์ผ์‹œ ์ฃผ์˜ ์‚ฌํ•ญ

* ์œˆ๋„์šฐ ํ™˜๊ฒฝ์—์„œ OpenSSL ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ํ•จ์ˆ˜๋ฅผ ์ถ”๊ฐ€ ํ•˜์—ฌ ์ปดํŒŒ์ผ ํ•˜๋Š” ๊ฒฝ์šฐ ํ•จ์ˆ˜์— ๋Œ€ํ•œ ์ •์˜ ์ •๋ณด๋ฅผ ์ถ”๊ฐ€ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ๊ธฐ๋ณธ OpenSSL ํ•จ์ˆ˜ ๊ฒฝ์šฐ utils/libcrypto.num ํŒŒ์ผ์— ๋‚ด์šฉ์„ ์ถ”๊ฐ€ ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ํ˜„์žฌ ์ถ”๊ฐ€ํ•œ ๊ฐ’์€ ์•„๋ž˜ ์™ธ ๊ฐ™๋‹ค OCSP_request_get0_name 5559 3_0_8 EXIST::FUNCTION:OCSP OSSL_CMP_CTX_getServer 5560 3_0_8 EXIST::FUNCTION:CMP OSSL_CMP_CTX_getServerPath 5561 3_0_8 EXIST::FUNCTION:CMP OSSL_CMP_CTX_getServerPort 5562 3_0_8 EXIST::FUNCTION:CMP OSSL_CMP_MSG_get0_body 55..

[OpenSSL] ECIES ์˜ˆ์ œ

์ด ์†Œ์Šค๋Š” GitHub ์—์„œ ๊ฐ€์ ธ์™”์Œ. https://github.com/insanum/ecies /* * Home: https://github.com/insanum/ecies * Author: Eric Davis */ #include #include #include #include #include #include #include #include #define err(fmt, ...) \ do { \ printf("ERROR:" fmt, ##__VA_ARGS__); \ exit(1); \ } while (0) #define log(fmt, ...) \ do { \ printf(fmt, ##__VA_ARGS__); \ } while (0) /* * This function takes a buffer wit..

Source Code 2022.12.09

[Openssl3] CMP freeText ๊ธฐ๋Šฅ ์ถ”๊ฐ€

cmp.h.in ์— ํ—ค๋” ์ถ”๊ฐ€ STACK_OF(OSSL_CMP_ITAV) *OSSL_CMP_exec_GENM_ses2(OSSL_CMP_CTX *ctx, ASN1_UTF8STRING **ppFreeText ); const ASN1_UTF8STRING* OSSL_CMP_get0_freeText( OSSL_CMP_PKIHEADER *hdr ); int OSSL_CMP_set0_freeText( OSSL_CMP_CTX *ctx, ASN1_UTF8STRING *text ); cmp_ctx.c ์†Œ์Šค ์— ์ถ”๊ฐ€ const ASN1_UTF8STRING* OSSL_CMP_get0_freeText( OSSL_CMP_PKIHEADER *hdr ) { if( hdr == NULL ) return NULL; return hdr-..

[Openssl3] OSSL_CMP_certConf_new ์ถ”๊ฐ€

cmp.h.in ํŒŒ์ผ์— OSSL_CMP_MSG* OSSL_CMP_certConf_new( OSSL_CMP_CTX *ctx, int fail_info, const char *text ); cmp_ctx.c ํŒŒ์ผ์— OSSL_CMP_MSG* OSSL_CMP_certConf_new( OSSL_CMP_CTX *ctx, int fail_info, const char *text ) { return ossl_cmp_certConf_new( ctx, fail_info, text ); } ์œˆ๋„์šฐ ์ง€์›์„ ์œ„ํ•ด์„œ๋Š” utils/libcrypto.num ์— ํ•จ์ˆ˜๋ช…์„ ์ถ”๊ฐ€ ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค. ์ถ”๊ฐ€ ํ•ด์คŒ ์ดํ•จ์ˆ˜๋Š” OpenSSL3 ์—์„œ๋งŒ ์ถ”๊ฐ€ ํ•ด์•ผํ•จ cmpossl ์— ์ด๋ฏธ ์กด์žฌ ํ•˜๋Š” ํ•จ์ˆ˜ ์ž„

[OpenSSL] OSSL_CMP_CERTSTATUS ์ •๋ณด ์–ป๊ธฐ ํ•จ์ˆ˜

cmp.h.in ์— ์•„๋ž˜ ํ—ค๋” ์ถ”๊ฐ€ ASN1_OCTET_STRING *OSSL_CMP_CERTSTATUS_get0_certHash( OSSL_CMP_CERTSTATUS *certStatus ); ASN1_INTEGER *OSSL_CMP_CERTSTATUS_get0_certReqId( OSSL_CMP_CERTSTATUS *certStatus ); OSSL_CMP_PKISI *OSSL_CMP_CERTSTATUS_get0_statusInfo( OSSL_CMP_CERTSTATUS *certStatus ); cmp_msg.c ์— ์•„๋ž˜ ์†Œ์Šค ์ถ”๊ฐ€ ASN1_OCTET_STRING *OSSL_CMP_CERTSTATUS_get0_certHash( OSSL_CMP_CERTSTATUS *certStatus ) { if( c..

[CMPOSSL] CMP CTX ์—์„œ serverName, serverPath, serverPort ์ •๋ณด ์–ป๊ธฐ ํ•จ์ˆ˜

cmp.h ์— ํ•จ์ˆ˜ ์ •์˜ ์ถ”๊ฐ€ const char* OSSL_CMP_CTX_getServerPath(OSSL_CMP_CTX *ctx); const char* OSSL_CMP_CTX_getServer(OSSL_CMP_CTX *ctx); int OSSL_CMP_CTX_getServerPort(OSSL_CMP_CTX *ctx); cmp_ctx.c ์— ์ฝ”๋“œ ์ถ”๊ฐ€ const char* OSSL_CMP_CTX_getServerPath(OSSL_CMP_CTX *ctx) { if( ctx == NULL ) return NULL; return ctx->serverPath; } int OSSL_CMP_CTX_getServerPort(OSSL_CMP_CTX *ctx) { if( ctx == NULL ) return -1; ..

[CMPOSSL] OSSL_CMP_REVDETAILS ์‚ฌ์šฉ ์ง€์› ํ•˜๊ธฐ

cmp_int.h ์—์„œ DEFINE_STACK_OF(OSSL_CMP_REVDETAILS) certDetails; } X509_EXTENSIONS* OSSL_CMP_REVDETAILS_get0_crlEntryDetails( const OSSL_CMP_REVDETAILS *details ) { if( details == NULL ) return NULL; return details->crlEntryDetails; } ์ฐธ๊ณ ) Openssl3 ์—์„œ๋Š” ์ ์šฉ์— ์–ด๋ ค์›€ ์žˆ์Œ( ์•„๋ž˜ ์ฒ˜๋ฆฌ ํ•จ ) cmp.h ์— X509_EXTENSIONS* OSSL_CMP_get0_crlEntryDetails( void *pRR_Body, int index ); cmp_ctx.c ์— X509_EXTENSIONS* OSSL_CMP_get..

[CMPOSSL] CRMF_CERTTEMPLATE ๋ฉ”์„ธ์ง€์—์„œ ๊ณต๊ฐœํ‚ค ๊ฐ’ ์–ป๊ธฐ

crmf.h ์— ์•„๋ž˜ ํ•จ์ˆ˜ ์ •์˜ ์ถ”๊ฐ€ X509_PUBKEY *OSSL_CRMF_CERTTEMPLATE_get0_publicKey( OSSL_CRMF_CERTTEMPLATE *tmpl); crmf_lib.c ํŒŒ์ผ์— ์•„๋ž˜ ๋‚ด์šฉ ์ถ”๊ฐ€ X509_PUBKEY *OSSL_CRMF_CERTTEMPLATE_get0_publicKey( OSSL_CRMF_CERTTEMPLATE *tmpl) { return tmpl != NULL ? tmpl->publicKey : NULL; } ์œˆ๋„์šฐ ์ง€์›์„ ์œ„ํ•ด์„œ๋Š” utils/libcrypto.num ์— ํ•จ์ˆ˜๋ช…์„ ์ถ”๊ฐ€ ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค.

[CMPOSSL] CMP ์—์„œ SenderKID ๊ฐ’ ์–ป๊ธฐ ํ•จ์ˆ˜

cmp.h.in ํ—ค๋”์— ์•„๋ž˜ ํ•จ์ˆ˜ ์ •์˜ ์ถ”๊ฐ€ ASN1_OCTET_STRING* OSSL_CMP_HDR_get0_senderKID( const OSSL_CMP_PKIHEADER *hdr ); cmp_lib.c ์— ์•„๋ž˜ ์†Œ์Šค ์ถ”๊ฐ€ ASN1_OCTET_STRING* OSSL_CMP_HDR_get0_senderKID( const OSSL_CMP_PKIHEADER *hdr ) { if( hdr == NULL ) return NULL; return hdr->senderKID; } ์œˆ๋„์šฐ ์ง€์›์„ ์œ„ํ•ด์„œ๋Š” utils/libcrypto.num ์— ๋‹ค์Œ ๊ฐ’์„ ์ฃผ์–ด์•ผ ํ•œ๋‹ค. OSSL_CMP_HDR_get0_senderKID 5573 3_0_0 EXIST::FUNCTION:CMP