예상 출력(CNG 예제)

CNG(Cryptography Next Generation) 보안 통신 예제는 각각 많은 양의 텍스트를 출력하는 세 가지 응용 프로그램으로 구성되어 있습니다.또한 예제에는 출력이 서로 다른 다섯 가지 버전이 포함되어 있습니다.이러한 응용 프로그램 및 버전에 대한 자세한 내용은 CNG 보안 통신 예제소스 코드 개요를 참조하십시오.

이 항목은 출력의 특정 부분을 보여 주는 다음과 같은 단원으로 구성되어 있습니다.

  • Alice, 옵션 메뉴

  • 가로채기를 수행하지 않는 버전 1-5, 자세한 정보 표시 안 함 모드

  • 가로채기를 수행하는 버전 3, 자세한 정보 표시 안 함 모드

  • 가로채기를 수행하는 버전 4-5, 자세한 정보 표시 모드

출력 단원에서 콜론 뒤에 보다 큼 기호가 나오면(:>) 프롬프트를 의미합니다.줄임표(...)는 출력 줄이 이전 출력 블록과 동일하여 생략되었음을 나타냅니다.

다음 그림에서는 세션 시작 시 세 콘솔 창을 모두 보여 줍니다.

CNG 출력

Alice, 옵션 메뉴

다음 출력에서는 세션 시작 시 Alice에서 표시하는 옵션 메뉴를 보여 줍니다.

Cryptography Next Generation Secure Communication Example
------------------------------------------------------------------
Please select a security model:
1 = Plaintext only.2 = Encrypt messages.3 = Encrypt messages, use public key to digitally sign messages.4 = Encrypt messages, use private key to digitally sign messages.5 = Encrypt messages, use private key to digitally sign messages
    and cryptographic keys.Causes Abort on security failures.x = Exit.:> 3
Include Mallory?y/n
:> y
Verbose output mode?y/n
:> y

가로채기를 수행하지 않는 버전 1-5, 자세한 정보 표시 안 함 모드

이 단원에서는 자세한 정보 표시 안 함 모드를 사용하고 Mallory의 가로채기를 해제할 때 버전 1-5에서 Alice.exe가 생성하는 출력 부분을 보여 줍니다.

Alice, 버전 1

다음 출력에서는 Alice와 Bob이 암호화, 디지털 서명 또는 가로채기를 사용하지 않고 기본적인 메시지 교환을 수행할 때의 동작을 보여 줍니다.

Cryptography Next Generation Secure Communication Example
Security Version: 1  Mode: Regular   Mallory: no   Signatures: no
-----------------------------------------------------------------------
Hi, I'm Alice Green.My sales associate is Bob White.I need to send him a customer order right now!:> Hi Bob.I have a new customer contact.Hi Alice.That is good news.Please send it to me.:> Here it is: Coho Winery, 111 AnyStreet, Chicago
   Thanks, I'll arrange to meet him....

Alice, 버전 2

다음 출력에서는 Alice와 Bob이 암호화 키를 사용하여 메시지를 암호화할 때의 동작을 보여 줍니다.

Cryptography Next Generation Secure Communication Example
Security Version: 2   Mode: Regular   Mallory: no   Signatures: no
-----------------------------------------------------------------------
...-----------------------------------------------------------------------
Now Bob will publicly send me his public cryptographic key:
Listening...-----------------------------------------------------------------------
Now that our keys have been exchanged,
we can have an encrypted conversation:
-----------------------------------------------------------------------
:> Hi Bob.I have a new customer contact.Hi Alice.That is good news.Please send it to me.:> Here it is: Coho Winery, 111 AnyStreet, Chicago
   Thanks, I'll arrange to meet him.-----------------------------------------------------------------------
...

Alice, 버전 3-5

다음 출력에서는 Alice와 Bob이 디지털 서명을 사용하여 키와 메시지에 서명할 때의 동작을 보여 줍니다.fMallory 플래그가 false이므로 가로채기가 수행되지 않고 이전 단원과 거의 동일하게 출력됩니다.

Cryptography Next Generation Secure Communication Example
Security Version: 3   Mode: Regular   Mallory: no   Signatures: yes
-----------------------------------------------------------------------
Hi, I'm Alice Green.My sales associate is Bob White.I need to send him a customer order right now!First, I will send Bob a digital signature key over a public channel.-----------------------------------------------------------------------
Now we will exchange our public cryptographic
keys through a public channel.First, I'll send Bob my key.Sending...-----------------------------------------------------------------------
Now Bob will publicly send me his public cryptographic key:
Listening...-----------------------------------------------------------------------
Now that our keys have been exchanged,
we can have an encrypted conversation:
-----------------------------------------------------------------------
...

가로채기를 수행하는 버전 3, 자세한 정보 표시 안 함 모드

이 버전에서는 fMallory 플래그가 true로 설정된 경우의 동작을 보여 줍니다.Bob이 Alice에게서 받는 주소를 살펴봅니다.이 주소를 이전 단원에서 Bob이 받은 주소와 비교해 보면Mallory가 주소를 가로채서 약간 변경했음을 확인할 수 있습니다.

Alice와 Bob은 각 메시지와 함께 디지털 서명을 보내지만 Mallory는 메시지를 가로챌 수 있습니다.이는 암호화된 암호화 키와 같은 비보안 채널을 통해 디지털 서명 키를 전송하기 때문입니다.Mallory는 두 키를 모두 가로챌 수 있으며,암호화 키를 사용하여 메시지를 암호화하고 디지털 서명 키를 사용하여 메시지에 서명합니다.Alice와 Bob은 같은 키를 사용하므로 아무도 보안 공격을 의심하지 않습니다.

Bob, 버전 3

다음은 Bob의 콘솔 창에 나타나는 출력입니다.이 출력은 Bob이 Mallory에게서 받는 메시지를 보여 줍니다.

Cryptography Next Generation Secure Communication Example
Security Version: 3   Mode: Regular   Mallory: yes   Signatures: yes
----------------------------------------------------------------------
Hi, I'm Bob White: My sales associate is Alice Green.I think she has a new customer contact for me!First, Alice will publicly send me a digital signature key.-----------------------------------------------------------------------
Now we will exchange our public cryptographic
keys through a public channel.First, Alice will send me her key.Listening...-----------------------------------------------------------------------
Next, I will send my public cryptographic key to Alice:
Sending...-----------------------------------------------------------------------
Now that our keys have been exchanged,
we can have an encrypted conversation:
-----------------------------------------------------------------------
   Hi Bob.I have a new customer contact.:> Hi Alice.That is good news.Please send it to me.Here it is: Coho Winery, 111 AnyStreet, Chicago
:> Thanks, I'll arrange to meet him.-----------------------------------------------------------------------...

Mallory, 버전 3

다음은 Mallory의 콘솔 창에 나타나는 출력입니다.이 출력은 Mallory가 Alice와 Bob의 메시지를 가로채서 변경하는 방법을 보여 줍니다.

Cryptography Next Generation Secure Communication Example
Security Version: 2   Mode: Regular   Mallory: yes   Signatures: no
-----------------------------------------------------------------------
Hi, I'm Mallory, the man in the middle.I wonder what Alice and Bob are talking about.I think I'll listen in.-----------------------------------------------------------------------
Alice and Bob are going to exchange their
public cryptographic keys through a public channel.First, Alice will send Bob her key.Good.I just intercepted Alice's public key:
Next, I will send my MalloryAlice public cryptographic key to Alice:

Sending...Next, I will send my MalloryBob public cryptographic key to Bob:

Sending...Now I will receive Bob's public key:
Good.I just intercepted Bob's public key:
-----------------------------------------------------------------------
Now that they have exchanged their keys,
they can have a secure conversation:
-----------------------------------------------------------------------
From Alice:
   Hi Bob.I have a new customer contact.To Bob:
:> Hi Bob.I have a new customer contact.From Bob:
   Hi Alice.That is good news.Please send it to me.To Alice:
:> Hi Alice.That is good news.Please send it to me.From Alice:
   Here it is: Coho Winery, 111 AnyStreet, Chicago
To Bob:
:> Coho Winery, OneEleven EveryStreet, Chicago
From Bob:
   Thanks, I'll arrange to meet him.To Alice:
:> I think the address is wrong, but I'll keep trying.-----------------------------------------------------------------------
I am so clever!Here is what I received: Coho Winery, 111 AnyStreet, Chicago
and here is what I sent: Coho Winery, OneEleven EveryStreet, Chicago

They will never catch me!-----------------------------------------------------------------------
...

가로채기를 수행하는 버전 4-5, 자세한 정보 표시 모드

버전 4와 5에서 Alice는 Bob에게 개인 디지털 서명 키를 전송하고, 두 사람은 이 키를 사용하여 메시지에 서명합니다.Mallory는 Alice가 키를 Bob에게 전송하는 데 사용하는 개인 채널을 알지 못하므로공개 채널에서 가로챈 디지털 서명 키를 계속 사용합니다.

Bob, 버전 4

이 단원에서는 자세한 전체 정보 출력을 보여 줍니다.암호화된 디지털 서명 키, 메시지 암호화 키 및 암호화된 메시지를 볼 수 있습니다.이 버전에는 확인되지 않은 디지털 서명이 발견되었다는 보안 경고도 포함되어 있습니다.

Cryptography Next Generation Secure Communication Example
Security Version: 4   Mode: Verbose   Mallory: yes   Signatures: yes
-----------------------------------------------------------------------
Hi, I'm Bob White: My sales associate is Alice Green.I think she has a new customer contact for me!First, Alice will publicly send me a digital signature key.Here it is:

☻???x???♥??♦ ?ie??t?VD?A?Y??▬☻§?Ed►??H?Hm2G¶?E??N?!`?☺¶^[←?↨?▬d?K9zdnJ
?☻?:↓?☺ ?L?K???C+♦??c?*7↓l?§??-??`L?h↓?GF?=???????????↔??&1|☺?????%?_????Now Alice privately sent me a digital signature key.I will use it instead.Here it is:

0??☻☺ 0►♠*?H?=☻☺♠♣+?♦ #♦??0??☻☺☺♦B☺??t
???♥??♦☺?V??)???s<m{sGM!?;~??d??Oc`♦?j??⌂§?d??b??????????,?♠  ??4?]???.??☺DN)3?=T↨??p>M???X?B????50??????E§?B?nr?z?/r??U????7,⌂?n?SL??,+
-----------------------------------------------------------------------
Now we will exchange our public cryptographic
keys through a public channel.First, Alice will send me her key.Listening...========  SECURITY ERROR!!===========
Cryptographic Key: Failure verifying digital signature.Here it is: an ECDH public KeyBlob
encoded within an XML string:

<ECDHKeyValue xmlns="http://www.w3.org/2001/04/xmldsig-more#">
  <DomainParameters>
    <NamedCurve URN="urn:oid:1.3.132.0.35" />
  </DomainParameters>
  <PublicKey>
    <X Value="5810718142462989354994453278603666484069278865008031317447
037792465942980799716553452148826647328907514445799324904361787703912513
195249832409677600954844765" />
    <Y Value="3280794663882281563639053942916365892460715799983953322007
508591453180081202861463948160922147015703385178443338980028430040655324
927942630539423460021361227" />
  </PublicKey>
</ECDHKeyValue>
-----------------------------------------------------------------------
Next, I will send my public cryptographic key to Alice:

Sending...Here it is: an ECDH public KeyBlob
encoded within an XML string:

<ECDHKeyValue xmlns="http://www.w3.org/2001/04/xmldsig-more#">
  <DomainParameters>
    <NamedCurve URN="urn:oid:1.3.132.0.35" />
  </DomainParameters>
  <PublicKey>
    <X Value="2455055322326895878650801953827546401118074905382497016837
137236585732889354895381530732942808710858667195863286496064074787137035
924365385948877294503335106" />
    <Y Value="1218921928274644208762495755994900948182290688858431853778
446672036473174952224569387259723200925573098776195363817761522302928910
53555717400648130000558239" />
  </PublicKey>
</ECDHKeyValue>
-----------------------------------------------------------------------
Now that our keys have been exchanged,
we can have an encrypted conversation:
-----------------------------------------------------------------------
   Incoming message:

??(??m?⌂4i?JOgion vector:  ?Ciphertext:
??∟↓[\▼?3♦Z GTGa>?&??,?x3f1Sh7L↓n?dc?I?A??\?P?l⌂X⌂@?V#??G??(O???6?♦☻)?PJ???@{N

   Signature:
?QF????¶☻       ~?YA?????oJ?7??{◄?oVg???L?→←3?⌂§?Y???Ca??S?Rl?v8(??????I0 ?♦?|???L9|??????????♦&)??gm??28?!??L?U?, ???N??@4??2§S

   Incoming decoded message:

   Hi Bob.I have a new customer contact.SECURITY WARNING!Received signature did not verify
-----------------------------------------------------------------------

:> Hi Alice.That is good news.Please send it to me.-----------------------------------------------------------------------
   Incoming message:

   Initialization vector:  ??4??♂??§??♫:(??Ciphertext:
?m?????y??x'~?<⌂yZ???G??Q????§????↕G??☼M?(?y[§▼→a?f%L??????←    ????y???&??z ?p?????[?p

   Signature:
 ???7[?ju???4??]???F?l?'-A??@?l??‼?¶F"k???g??♀{??S??????▲?t.?;???↕▬?u?♠♀
?!%}?????∟?☻?*?a?"◄o??▬??,?w??F▲k??Y∟?▲???j??T???↕♫2???Incoming decoded message:

   Coho Winery, OneEleven EveryStreet, Chicago
SECURITY WARNING!Received signature did not verify
-----------------------------------------------------------------------
:> Thanks, I'll arrange to meet him.-----------------------------------------------------------------------

Bob, 버전 5

이전 버전과 마찬가지로 버전 5에서는 개인 디지털 서명 키를 사용하여 메시지 암호화 키에 서명합니다.또한 이 버전에서는 보안 오류가 발생하는 즉시 세션을 종료합니다.

Cryptography Next Generation Secure Communication Example
Security Version: 5   Mode: Verbose   Mallory: False   Sign keys: true
-----------------------------------------------------------------------
Hi, I'm Bob White: My sales associate is Alice Green.I think she has a new customer contact for me!First, Alice will publicly send me a digital signature key.Here it is:
...Now Alice will privately sent me a digital signature key.I will use it 
instead.Here it is:
...-----------------------------------------------------------------------
Now we will exchange our public cryptographic
keys through a public channel
First, Alice will send me her key.Listening...========  SECURITY ERROR!===========
Cryptographic Key: Failure verifying digital signature.Contact your security administrator.TERMINATING SESSION

참고 항목

개념

CNG(Cryptography Next Generation) 보안 통신 예제

암호화 서비스