Upload
nituna
View
43
Download
2
Embed Size (px)
DESCRIPTION
Key Managemnet. ์ํํธ์จ์ด๊ณตํ ์คํ์ค ๊น๊ฒฝํ, ์ ์์, ๋ฏผ๋ณ๋. ๋ชฉ ์ฐจ. ์ ๊ฐ Keys Key Generators ์ Translators Key Agreement The Identity Key Management Paradigm The KeyStore Key Management Paradigm ๊ฒฐ ๋ก . ๊ตฌ์ฑ. The KeyStore Key Management Paradigm. Keys Key Generators Key Translators - PowerPoint PPT Presentation
Citation preview
1Computer Network Lab.
Key Managemnet
์ํํธ์จ์ด๊ณตํ ์คํ์ค
๊น๊ฒฝํ , ์ ์์ , ๋ฏผ๋ณ๋
2Computer Network Lab.
๋ชฉ ์ฐจ๋ชฉ ์ฐจ
์ ๊ฐ์ ๊ฐ KeysKeys
Key GeneratorsKey Generators ์ ์ TranslatorsTranslators
Key Agreement Key Agreement
The Identity Key Management ParadigmThe Identity Key Management Paradigm
The KeyStore Key Management ParadigmThe KeyStore Key Management Paradigm
๊ฒฐ ๋ก ๊ฒฐ ๋ก
3Computer Network Lab.
์ ๊ฐ์ ๊ฐ ๋ฐฐ๊ฒฝ๋ฐฐ๊ฒฝ :: ๊ฐ์ธ์ ๋ณด์ ๋ณดํธ๋ฅผ ์ํ์ฌ ์ํธ ํค ์ฌ์ฉํ๊ฒ ๋์๊ณ , ๋ฐ๋ผ์ ์ํธ ํค์ ๊ด๋ฆฌ ๋ฌธ์ ๊ฐ ๋ํ๋จ .
Sun ์ ํค ๊ด๋ฆฌ๋ฅผ ์ํ ์ธํฐํ์ด์ค์ ํด๋์ค๋ฅผ ์ ๊ณต (JDK).
JDK class ์ interface ๊ฐ ํค๋ฅผ ๊ด๋ฆฌํ๊ณ ํํํ๋๋ฐ ์ฌ์ฉ
KeysKeysKey GeneratorsKey GeneratorsKey TranslatorsKey TranslatorsKey Agreement Key Agreement
KeysKeysKey GeneratorsKey GeneratorsKey TranslatorsKey TranslatorsKey Agreement Key Agreement
The Identity KeyManagementParadigm
The Identity KeyManagementParadigm
The KeyStore KeyManagementParadigm
The KeyStore KeyManagementParadigm
๊ตฌ์ฑ
4Computer Network Lab.
Keys(1/3)Keys(1/3)
Public String getAlgorithm()Public String getAlgorithm()
Public byte[] getEncoded() Public byte[] getEncoded()
Public String getFormat() Public String getFormat()
java.security.Keyjava.security.Key
์ธํฐํ์ด์ค์ธํฐํ์ด์ค
java.security.PublicKey java.security.PublicKey
java.security.PrivateKey java.security.PrivateKey
java.securityjava.securityjava.securityjava.security
public PublicKey getPublic() public PublicKey getPublic()
public PivateKey getPrivate() public PivateKey getPrivate()
ํด๋์คํด๋์ค
java.security. KeyPair java.security. KeyPair
javax.crypto.SecretKeyjavax.crypto.SecretKey
javax.cryptojavax.crypto์ธํฐํ์ด์ค์ธํฐํ์ด์ค
5Computer Network Lab.
Keys(2/3)Keys(2/3)
๋ฉ์๋ public String getAlgorithm()
- ํค์์ ์ฌ์ฉ๋ ์ํธ ์๊ณ ๋ฆฌ์ฆ ๋ฆฌํด ( ์ :DSA, DSA, MD5, RSA ๋ฑ )
public byte[] getEncoded() - ์ํธํ๋ ๊ฐ ๋ฆฌํด ( ์ํธํ๋ ๋ฐ์ดํธ ๋ฐฐ์ด์ ํค ๊ฐ์ ์ ์ฉ ) public String getFormat() - ์ํธํ์ ์ฌ์ฉ๋ ํค ํฌ๋งท์ ์ด๋ฆ ๋ฆฌํด ( ์ :X.509, PKCS#8)
java.security.Key ์ธํฐํ์ด์ค - ๋ชจ๋ ํค์ ๊ณตํต์ ๊ธฐ๋ฅ์ ์ ์ํ๋ ์ธํฐํ์ด์ค
- ๋น๋ฐ ํค์ ์ฌ์ฉ๋๋ ์ธํฐํ์ด์ค ( ๊ฐ์ธ ๋๋ ์ธ์ ํค )
java.crypto.SecuretKey ์ธํฐํ์ด์ค
6Computer Network Lab.
Keys(3/3)Keys(3/3)
java.security.PublicKey
- ๊ณต๊ฐ ํค์ ์ฌ์ฉ๋๋ ์ธํฐํ์ด์ค java.security.PrivateKey
- ๊ฐ์ธ ํค์ ์ฌ์ฉ๋๋ ์ธํฐํ์ด์ค
JDK JDK ์ธํฐ ํ์ด์ค์ธํฐ ํ์ด์ค (( ํ์ ์ ์์ ์ฑ๊ณผ ํค ํ์ธํ์ ์ ์์ ์ฑ๊ณผ ํค ํ์ธ ))
JDK JDK ํด๋์คํด๋์ค public KeyPair(PublicKey publicKey, PrivateKey privateKey) - ๊ณต๊ฐ ํค์ ๊ฐ์ธ ํค๋ก ์ด๋ฃจ์ด์ง๋ ํค ์ ์์ฑ ๋ฉ์๋ : public PublicKey getPublic() - ๊ณต๊ฐ ํค ๋ฆฌํด public PrivateKey getPrivate() - ๊ฐ์ธ ํค ๋ฆฌํด
7Computer Network Lab.
Key Generator(1/6)
: ์ํธ ํค ์์ฑ ( ์ํธํค : ํค ๋๋ ํค ์ ) ์ํธ ํค ์์ฑ ๋จ๊ณ์ํธ ํค ์์ฑ ๋จ๊ณ
1. ์ฌ์ฉํ๊ธฐ๋ฅผ ์ํ๋ ์๊ณ ๋ฆฌ์ฆ์ ๋ํ ํค Generator ๊ฐ์ฒด ํ๋2. ํค genetator ์ด๊ธฐํ3. ํค ๋๋ ํค ์์ ์์ฑ์ key generator ์๊ฒ ์์ฒญ
java.securityjava.securityํด๋์คํด๋์ค
Public abstract void initialize(int strength, SecureRandom random)Public abstract void initialize(int strength, SecureRandom random)
Public void initialize(int strength)Public void initialize(int strength)
Public abstract KeyPair genKeyPair() Public abstract KeyPair genKeyPair()
java.security.KeyPairGeneratorjava.security.KeyPairGenerator
8Computer Network Lab.
Key Generator(2/6)
javax.cryptojavax.cryptoํด๋์คํด๋์ค
Public final void init(SecureRandom random)*Public final void init(SecureRandom random)*
Public final void init(int strength) Public final void init(int strength)
Public final void init(int strength, SecureRandom random) Public final void init(int strength, SecureRandom random)
javax.crypto.KeyGeneratorjavax.crypto.KeyGenerator
Public final SecretKey generateKey( ) Public final SecretKey generateKey( )
9Computer Network Lab.
Key Generator(3/6)Key Generator(3/6)
Generator Generator ์ด๊ธฐํ ๋ฉ์๋์ด๊ธฐํ ๋ฉ์๋
public abstract void initialize(int strength, SecureRandom random)
: ๋ณด์๊ฐ๋ ( ์ค์ ๋ก ํค๊ฐ ์ฐจ์งํ๋ ๋นํธ ์ ) ์ ๋์๋ก ์ด๊ธฐํ
public void initialize(int strength)
: ๋ณด์ ๊ฐ๋๋ก ์ด๊ธฐํ
KeyPairGenerator KeyPairGenerator ํด๋์คํด๋์ค: java.security.KeyPairGenerator- ๊ณต๊ฐ ํค์ ๊ฐ์ธ ํค ์์ ์์ฑํ๊ณ
KeyPair ๋ก ๋ฆฌํด . Generator Generator ๊ฐ์ฒด๋ฅผ ๊ฐ์ฒด๋ฅผ getInstance() getInstance() ๋ฉ์๋์ ์๊ณ ๋ฆฌ์ฆ์ ์ข ๋ฅ๋ฅผ ๋ช ์ํ๋ ๋ฉ์๋์ ์๊ณ ๋ฆฌ์ฆ์ ์ข ๋ฅ๋ฅผ ๋ช ์ํ๋
๋ฌธ์์ด ์ธ์๋ฅผ ์ ์ฉํจ์ผ๋ก ์์ฑ๋ฌธ์์ด ์ธ์๋ฅผ ์ ์ฉํจ์ผ๋ก ์์ฑ Ex) KeyPairGenerator kpg = KeyPairGenerator.getInstance(โElGamalโ)
- ์๊ณ ๋ฆฌ์ฆ์ ๋ฐ๊ฒฌํ์ง ๋ชปํ ์ NoSuchAlgorithmException ๋์
10Computer Network Lab.
Key Generator(4/6)Key Generator(4/6)
ํค ์์ฑ ๋ฉ์๋ํค ์์ฑ ๋ฉ์๋ Public abstract KeyPair genKeyPair()
: ์ด์ ์ initialze() ์์ ๋ช ์๋ ๊ฐ๋์ ๋๋ค ๋นํธ ์์ค๋ฅผ ์ฌ์ฉํ์ฌ
key pair ๋ฅผ ์์ฑ
Ex)
KeyPairGenerator kpg = KeyPairGenerator.getInstance(โDSAโ);
kpg.initialize(1024);
keyPair pair = kpg.genKeyPair();
11Computer Network Lab.
Key Generator(5/6)Key Generator(5/6)
KeyGenerator KeyGenerator ํด๋์คํด๋์ค: ๋์นญ ์ํธ์์์ ํ๋์ ํค ์์ฑ . ๋ฐ๋ผ์ JCE ๋ jvax.crypto.KeyGenerator ๋ผ๋ ๋๋คํ ํ๋์ ํค๋ฅผ ์์ฑํ๋ ํด๋์ค ํฌํจ
์ด๊ธฐํ ๋ฉ์๋์ด๊ธฐํ ๋ฉ์๋Public final void init(SecureRandom random)*
: ๋์ ์ฌ์ฉํ์ฌ KeyGenerator ์ ์ด๊ธฐํPublic final void init(int strength)
: ๋ณด์ ๊ฐ๋ ์ฌ์ฉPublic final void init(int strength, SecureRandom random)
: ๋ณด์ ๊ฐ๋์ ๋์ ์ฌ์ฉ
Generator Generator ๊ฐ์ฒด ํ๋๊ฐ์ฒด ํ๋ KeyGenerator kg = KeyGenerator.getInstance(โDESโ)
12Computer Network Lab.
Key Generator(6/6)Key Generator(6/6)
Public final SecretKey generateKey() : ์๋ก์ด ๋๋ค SecretKey ๋ฅผ ์์ฑ
Ex)
KeyGenerator kg = KeyGenerator.getInstance (โDESโ);
Kg.init(new SecureRandom());
SecretKey key = kg.generateKey();
ํค ์์ฑ ๋ฉ์๋
13Computer Network Lab.
Algorithm-Specific Initialization(1/2)
: Java.security.KeyPairGenerator ์ javax.crypto.KeyGeneratorsms Algorithm-Specific Initialization ์ ๊ฐ๋ ์ ์ง์ - ์ฌ์ฉํ๋ ์๊ณ ๋ฆฌ์ฆ์ ๋ํ ์ ํด์ง ํ๋ผ๋ฉํฐ๋ฅผ ์ฌ์ฉ๊ฐ๋ฅ
Java.security.KeyPairGenerator ๋ Algorithm-Specific Initialization ์ ์ํ ํ๋์ ๋ฉ์๋ ํฌํจ
Public void initialize(AlgorithmParameterSpec params) throws
InvalidAlgorithmParameterException : ๋ง์ผ AlgorithmParameterSpec ๊ฐ์ฒด๊ฐ ์ธ์ ๋์ง ์๋๋ค๋ฉด , ์์ธ์ฒ๋ฆฌ
14Computer Network Lab.
javax.crypto.KeyGenerator ๋ Algorithm-Specific Initialization ์ ์ํ ๋ ๊ฐ์ ๋ฉ์๋ ํฌํจ Public final void init(AlgorithmParameterSpec params) throws
InvalidAlgorithmParameterException
: ๋ง์ผ AlgorithmParameterSpec ๊ฐ์ฒด๊ฐ ์ธ์ ๋์ง ์๋๋ค๋ฉด , ์์ธ์ฒ๋ฆฌ
Public final void init(AlgorithmParameterSpec params,
SecureRandom random) throws
InvalidAlgorithmParameterException
: ๋ง์ผ AlgorithmParameterSpec ๊ฐ์ฒด๊ฐ ์ธ์ ๋์ง ์๋๋ค๋ฉด , ์์ธ์ฒ๋ฆฌ
Algorithm-Specific Initialization(2/2)
15Computer Network Lab.
Key Translator(1/8)Key Translator(1/8)
Problem) ๋์คํฌ์์์ ํค ์ ์ฅ , ๋คํธ์ํฌ์์์ ํค ์ ์ก Solution) ๋ฐ์ดํธ ์ด ๋จ์๋ก ํค ์ ์ฅ ๋๋ ์ ์ก ๋ฐ์ดํธ ์ด๊ณผ vice versa ๋ก Key ๊ฐ์ฒด ๋ณํ ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ฒด ๋ณํ
ClassClass
java.crypto.SecretKeyFactoryjava.crypto.SecretKeyFactory
javax.crypto.spec.SecretKeySpecjavax.crypto.spec.SecretKeySpec
javax.security.KeyFactoryjavax.security.KeyFactory
16Computer Network Lab.
SecretKeySpec
: javax.crypto.spec.SecretKeySpec ํด๋์ค๋ ๋น๋ฐ ํค์ ๋ฐ์ดํธ ์ด์
๋ณํํ๋ ๊ฐ์ฅ ๊ฐ๋จํ ๋ฐฉ๋ฒ . ๋ ๊ฐ์ ์์ฑ์๋ฅผ ๊ฐ์ง๊ณ ์์ด . pubic SecretKeySpec(byte[] key, String algorithm) : ์ ๊ณต๋ ๋ฐ์ดํธ ์ด์์ ์ฌ์ฉํ์ฌ SecretKeySpec ์ ์์ฑ . Key ์ ์๊ณ ๋ฆฌ์ฆ ์ ๊ณต . pubic SecretKeySpec(byte[] key, int offset, int len, String algorithm) : ์ ๊ณต๋ ๋ฐ์ดํธ ๋ฐฐ์ด์ Offset ์์ ์์ํ๋ len ๋ฐ์ดํธ๋ค์ ์ฌ์ฉํ์ฌ SecretKeySpec ์ ์์ฑ . ์ ๊ณต๋ ์๊ณ ๋ฆฌ์ฆ ๊ฐ์ง .
์์ ) SecureRandom sr = new SecureRandom(); Byte[] keyByte = new byte[20]; Sr.nextBytes(keyBytes); SecretKey key = new SecretKeySpec (keyBytes, โHmacSHA1โ);
Key Translator(2/8)Key Translator(2/8)
17Computer Network Lab.
SecretKeyFactory SecretKeyFactory ํด๋์คํด๋์ค : java.crypto.SecretKeyFactory ํด๋์ค๋ getInstance() ํจ์๋ฅผ ์ด์ฉํ์ฌ
SecretKeyFactory ๋ฅผ ์์ฑ . ๋ ๊ฐ์ ์์ฑ์ ๊ฐ์ง . pubic static final SecretKeyFactory getInstance(String algorithm) throws NoSuchAlgorithmException : ์ฃผ์ด์ง ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ์ฌ ์๋ก์ด SecretKeyFactory ์์ฑ ์๊ณ ๋ฆฌ์ฆ ์ด๋ฆ ( ์ :DES) ์ด ๋์นญ ์ํธ ์๊ณ ๋ฆฌ์ฆ ์ด๋ฆ๊ณผ ์ผ์นํด์ผํจ pubic static final SecretKeyFactory getInstance(String algorithm, String
provider) throws NoSuchAlgorithmException, NoSuchProviderException : ์๊ณ ๋ฆฌ์ฆ๊ณผ ์ ๊ณต์๋ฅผ ์ฌ์ฉํ์ฌ , ์๋ก์ด SecretKeyFactory ์์ฑ
Key Translator(3/8)Key Translator(3/8)
-SecretKeyFactory ๋ฅผ ๊ฐ์ง๊ณ ์๋ค๋ฉด , KeySpec ์ SecretKey ์ฌ์์์ key translate ๊ฐ ์์ ๋กญ๋ค
18Computer Network Lab.
Key Translator(4/8)Key Translator(4/8)
From things to keysFrom things to keys: SecretKey ์์ KeySpec ๋ก์ translate ๋ SecretFactory ์
generatorSecret() ํจ์๋ฅผ ์ฌ์ฉํ๋ค pubic final SecretKey generateSecret(KeySpec keySpec) throws
InvalidKeySepcException :keySpec ์ ์ ๋ณด๋ฅผ ์ฌ์ฉํ์ฌ , SecretKey ์์ฑ . ๋ง์ผ KeySpec ์ด
์ธ์ ๋์ง ์๋๋ค๋ฉด , ์์ธ์ฒ๋ฆฌ Ex) DES ํค ์์ฑ pubic SecretKey makeDESKey(byte[] input, int offset) throws
NoSuchAlgorithmException, InvalidKeySepcException, InvalidKeySpecException {
SecretKeyFactory desFactory = SecretKeyFactory.getInstance(โDESโ);
KeySpec spec = new DESKeySpec(input, offset);
Return desFactory.generateSecret (spec);
}
19Computer Network Lab.
Key Translator(5/8)Key Translator(5/8)
makeDESKey() ํจ์์ ๋จ๊ณ
์์ธ์ฌํญ getInstance() ํจ์ -NoSuchAlgorithmException generatorSecret() ํจ์ -InvalidKeyException ( ์ ํํ์ง ์์ ํค ๊ธธ์ด ์ ๋ฌ )generatorSecret() ํจ์ -InvalidKeySpecException(KeySpec ์์ ๋ถ์ธ์ )
1.DES ํค๋ฅผ ์ํ ํค ์์์ ํ๋ . SecretKey.getInstance() ๋ฅผ ์ฌ์ฉ2.KeySpec ์ ์ ๊ณต๋ ๋ฐ์ดํธ ์ด๋ก๋ถํฐ DES ํค ๋ฐ์ดํฐ ํ์ ์์ฑ3.KeySpec ๋ก๋ถํฐ์ SecretKey ์์ฑ . generateSecret() ๋ฅผ ์ฌ์ฉ
20Computer Network Lab.
Key Translator(6/8)Key Translator(6/8)
From keys to thingsFrom keys to things : SecretFactory ๋ SecretKey ๋ก๋ถํฐ KeySpec ์์ฑํ๋ ๋ฐฉ๋ฒ ์์ Public final KeySpec getKeySpec(SecretKey key, Class keySpec)
throws
InvalidKeySpecException
: ์ฃผ์ด์ง SecretKey ๋ก ๋ถํฐ KeySpec ์์ฑ . keySpec ํ๋ผ๋ฉํฐ๋ ๋ฆฌํด๋๋ ๊ฐ์ฒด์ ํํ ๊ฒฐ์
Ex)
public byte[] makeBytesFromDESKey(SecretKey key) throws NoSuchAlgorithmException, InvalidKeySepcException {
SecretKeyFactory desFactory = SecretKeyFactory.getInstance(โDESโ);
KeySpecSpec spec = (DESKeySpec) desFactory.getKey(key, DESKeySpec.class);
return spec.getKey();}
21Computer Network Lab.
Key Translator(7/8)Key Translator(7/8)
KeyFactory KeyFactory ํด๋์คํด๋์ค: Java.security.KeyFactory ํด๋์ค๋ SecretKeyFactory ์ ์ ์ฌ .
๊ณต๊ฐํค์ ๊ฐ์ธํค์ ์ ์ฉPublic static final KeyFactory getInstance(String algorithm) throws
NoSuchAlgrithmException
: ์ฃผ์ด์ง ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ์ฌ ์๋ก์ด KeyFactory ์์ฑ์ ์ฌ์ฉ
: ์๊ณ ๋ฆฌ์ฆ ์ด๋ฆ์ ๋น๋์นญ ์๊ณ ๋ฆฌ์ฆ ์ด๋ฆ์ด๊ฑฐ๋
์๋ช ์๊ณ ๋ฆฌ์ฆ ( ์ :DSA) ์ผ๋ก ํด์ผํจPublic static final KeyFactory getInstance(String algorithm, String provider)
throws NoSuchAlgrithmException, NoSuchProviderException
: ์ ๊ณต๋ ์ ๊ณต์์ ์ด๋ฆ์ ๊ตฌํ์ ์ฌ์ฉํ์ฌ , ์๋ก์ด KeyFactory ์์ฑ
22Computer Network Lab.
Key Translator(8/8)Key Translator(8/8) PublicKey ๋๋ Privatekey ๋ KeySpec ์ผ๋ก ๋ถํฐ์ ๋ณํ์
generatePublic() ์ generatePrivate() ๋ฉ์๋ ์ฌ์ฉ Public final PublicKey generatePublic(KeySpec keySpec) throws
InvalidKeySpecException
: ์ง์ ๋ KeySpec ์ PublicKey ์์ฑ์ ์ฌ์ฉ : ๋ง์ผ KeySpec ์ด KeyFactory ์ ์ธ์ ๋์ง ์์ผ๋ฉด , ์์ธ์ฒ๋ฆฌ Public final PrivateKey generatePrivate(KeySpec keySpec) throws
InvalidKeySpecException
: ์ง์ ๋ KeySpec ์ ๊ฐ์ธํค ์์ฑ์ ์ฌ์ฉ KeyFactory ๋ ๊ณต๊ฐํค์ ๊ฐ์ธํค๋ฅผ ๋์์ ์กฐ์ ํ๋ getKeySpec()
์ ๊ฐ๋๋ค Public final KeySpec getKeySpec(Key key, Class keySpec) throws
InvalidKeySpecException
: ์ง์ ๋ ํค๋ก ๋ถํฐ KeySpec ์์ฑ
23Computer Network Lab.
Key Agreement(1/7)Key Agreement(1/7)
: ๋ ๊ฐ ์ด์์๋ถ๋ถ์ ๋์ผํ secret ๊ฐ์ ์์ ํ๊ฒ ํ๋ ํ๋กํ ์ฝ ์ธ์ ํค์์๋ ์ฌ์ฉ
ํน์ง : ๋น์์ ์ฑ๋ ์ฌ์ฉ ( ์ : ์ธํฐ๋ท ) ์ธ์ฆ์๋ ์ฌ์ฉํ์ง ๋ชปํจ ์ง์ ์ ์ธ ํค ์ ์ก์ ํ์ง ์๋๋ค ์ฌ์ฉ์๊ฐ n ์ผ์ , n-1 ๋ฐ์ดํ ๊ตํ ํ์
Diffie-Hellman - ๊ฐ์ฅ ๋๋ฆฌ ์ฌ์ฉ ๋จ - 1976 ๋ ๊ฒฝ ๋ฐํ
Notation- p : prime number - g: primitive mod p- xm, x r : random number - ym, y r : public key
- y = g x mod pxr x m
x r
- k = g mod p= y mod p = y mod p
m
rx m
m
24Computer Network Lab.
Key Agreement(2/7)Key Agreement(2/7)
1. p ์ g ์ ํ . ๊ฐ์ ์์๊ฒ ๋ฐฐํฌ
Marian
Robin
2. x ์ ํ . y ๊ณ์ฐ
3. y ๋ก๋น์๊ฒ ์ ์ก
2. x ์ ํ . y ๊ณ์ฐ3. y ๋ง๋ฆฌ์์๊ฒ ์ ์ก
m
rr
r
mm
x r
k = g mod p= y mod p = y mod p
m
rx m
xr x m4. ๋์ผํ ์์
m
25Computer Network Lab.
Key Agreement(3/7)Key Agreement(3/7)
Javax.crypto.KeyAgreement :Javax.crypto.KeyAgreement ๋ ํค agreement ํ๋กํ ์ฝ์ ์บก์ํ :SunJCE ๋ Diffie-Hellman ์ด ๊ธฐ๋ฐ์ด๋๋ KeyAgreemnet ์ ๊ณต KeyAgreement ๊ฐ์ฒด ํ๋์ ์ํ์ฌ , getInstance() ๋ฉ์๋ ์ฌ์ฉ Public static final KeyAgreement getInstance(String algorithm) throws NosuchAlgorithmException : ์ฃผ์ด์ง ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ์ฌ ์๋ก์ด KeyAgreement ์์ฑ Public static final KeyAgreement getInstance(String algorithm, String
provider) throws NosuchAlgorithmException, NoSuchProviderException : ์ฃผ์ด์ง ์ ๊ณต์์ ์ด๋ฆ์ผ๋ก , ์๋ก์ด KeyAgreement ์์ฑ
26Computer Network Lab.
Key Agreement(4/7)Key Agreement(4/7)
KeyAgreement KeyAgreement ์ด๊ธฐํ ๋ฉ์๋์ด๊ธฐํ ๋ฉ์๋Public final void init (Key key) throws InvalidKeyException : ์ ๊ณต๋ ํค๋ฅผ ์ฌ์ฉํ์ฌ KeyAgreement ์ด๊ธฐํ : ์ฌ๋ฐ๋ฅธ ํค ํํ๊ฐ ์๋๋ผ๋ฉด ์์ธ์ฒ๋ฆฌ ๋ฐ์Public final void init (Key key, SecureRandom random) throws InvalidKeyException : ์ ๊ณต๋ ํค์ ๋์๋ก KeyAgreement ์ด๊ธฐํPublic final void init (Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException : ์ ๊ณต๋ ํค์ AlgorithmParameterSpec ์ผ๋ก KeyAgreement ์ด๊ธฐํPublic final void init (Key key, AlgorithmParameterSpec params,
SecureRandom random) throws
InvalidKeyException, InvalidAlgorithmParameterException
: ์ ๊ณต๋ ํค , AlgorithmParameterSpec, SecureRandom ๋ก KeyAgreement ์ด๊ธฐํ
27Computer Network Lab.
Key Agreement(5/7)Key Agreement(5/7) Public final Key doPhase (Key key, boolean lastPhase) throws
InvalidKeyException, IllegalStateException
: ๊ณต๊ฐ ํค ๊ฐ ๋ฆฌํด . lastPhase ๋ ํค agreement ๊ฐ ์ํ๋๊ธฐ ์์ํ ๋ง์ง๋ง ๋จ๊ณ ์ง์
Public final byte[] generateSecret() throws IllegalStateException :secret ๊ฐ ๋ฆฌํด . KeyAgreement ์ ๋ชจ๋ ๋จ๊ณ ๋ฏธ์คํ์ , ์์ธ์ฒ๋ฆฌ Public final init generateSecret(byte[] sharedSecret, int offset) throws
IllegalStateException, ShortBufferException :offset ์์ ์์ํ ๋ฐฐ์ด์ secret ๊ฐ write. ๋ฐฐ์ด ๊ธธ์ด ๋ถ์ถฉ๋ถ์
์์ธ์ฒ๋ฆฌ Public final init generateSecret(String algorithm) throws
InvalidKeyException, IllegalStateException, NoSuchAlgorithmException
: ์ฃผ์ด์ง ์๊ณ ๋ฆฌ์ฆ์ผ๋ก SecretKey ์ ๋ํ secret ๊ฐ ๋ฆฌํด
Secret ๊ฐ ์ถ์ถ
28Computer Network Lab.
Key Agreement(6/7)Key Agreement(6/7)SKIP SKIP (Simple Key Internet Protocol)
Diffie-Hellman ์ฌ์ฉ์ธ์ ํค ์ฌ์ฉ๋ก์ปฌ ๋คํธ์ํฌ์ VPN(Virtual Private Key) ์์ ์ฌ์ฉํค ํฌ๊ธฐ์ ๋ฐ๋ฅธ ์ธ๊ฐ์ง ๋ค๋ฅธ ๋ฒ ์ด์ค์ ๋ชจ๋ ์ ๊ณต
SKIP ๋ฒ ์ด์ค์ ๋ชจ๋ ๊ฐ์ ์ํ ํด๋์ค๋ฅผ ์ ์ ํด๋์ค { String // 16 ์ง๋ฒ์ผ๋ก ๋ชจ๋ ๊ฐ์ ํ์ํ๊ธฐ ์ํ์ฌ ์คํธ๋ง ์ ์ ๋ชจ๋ // BigInteger ์ ์ด์ฉํ์ฌ ๋ชจ๋ ๊ฐ ์์ฑ ๋ฒ ์ด์ค // ๋ฒ ์ด์ค ๊ฐ ์์ฑ ์ ์ฅ // DHParamterSpec ์ ๋ชจ๋๊ณผ ๋ฒ ์ด์ค ๊ฐ ์ ์ฅ }
29Computer Network Lab.
Key Agreement(7/7)Key Agreement(7/7)
1. Key Pair ์์ฑ
2. ๋คํธ์ํฌ ์ฐ๊ฒฐ wait
3. ๊ณต๊ฐ ํค ์์
4. KeyFactory ๋ฅผ ์ด์ฉ ํค ์ฌ๊ตฌ์ฑ
5. ์์ ์ ๊ณต๊ฐํค ์ ์ก
6. Secret ๊ฐ ๊ณ์ฐ
1.Key Pair ์์ฑ2. ๋ช ๋ น ๋ผ์ธ์ host IP ์ ํฌํธ ์ ๋ ฅํ์ฌ ๋คํธ์ํฌ ์ฐ๊ฒฐ .
๊ณต๊ฐ ํค ์ ์ก
3. ๊ณต๊ฐํค ์์
4. KeyFactory ๋ฅผ ์ด์ฉ ํค ์ฌ๊ตฌ์ฑ
5. Secret ๊ฐ ๊ณ์ฐ
7. Secret ๊ฐ ์ถ๋ ฅ 6. Secret ๊ฐ ์ถ๋ ฅ
์ ๋ฒ ํด๋ผ์ด์ธํธ
30Computer Network Lab.
1. Identity Key Management ์ ์ ์2. Key Holders
- Principal
- Identity
- Signer
- IdentityScope
4. KeyManager ๊ตฌํ
๋ชฉ ์ฐจ
31Computer Network Lab.
โข Identity Key Management ๋ ?โ JDK 1.1 ์์ java.security.Identity ํด๋์ค๋ฅผ ์ฌ์ฉํ
ํค๊ด๋ฆฌ* JDK 1.2 ์์๋ Keystore-based Key Management ๋ก ๋ฐ๋
โ ๊ตฌ์ฑโข Identity
; ๊ณต๊ฐํค์ ๊ด๋ จ์ ๋ณด๋ค์ ํฌํจโข Signer
; ๊ณต๊ฐํค์ ๊ฐ์ธํค , ๊ทธ๋ฆฌ๊ณ ๊ด๋ จ์ ๋ณด๋ค์ ํฌํจโข IdentityScope
; Identity ์ ๊ทธ๋ฃน์ ํ์ํ๋ฉฐ Identity ๊ฐ์ฒด๋ฅผ ๊ฐ์ง
The Identity Key Management Paradigm
32Computer Network Lab.
The Identity Key Management Paradigm
Identity Scope (Marianโs computer)Identity Scope (Marianโs computer)
Identity Scope (Merry Men)Identity Scope (Merry Men)
Signer (Marian)๊ณต๊ฐํค๊ฐ์ธํค
๊ธฐํ ์ ๋ณด๋ค
Signer (Marian)๊ณต๊ฐํค๊ฐ์ธํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Sheriff)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Sheriff)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Will)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Will)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Tuck)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Tuck)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Robin)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Identity (Robin)๊ณต๊ฐํค
๊ธฐํ ์ ๋ณด๋ค
Figure : Identity-based key management
33Computer Network Lab.
Java.security For the Identity Key Management
InterfaceInterface
ClassClass
Principal
Signer
Identity
IdentityScope
Method getName()Method getName()
Constructor identity() identity(String name) identity(String name, IdentityScope scope)Method getPublicKey() setPulicKey(Publickey key) addCertificate(Certificate certificate) removeCertificate(Certificate certificate) Certificate[] getCertificates()
Constructor identity() identity(String name) identity(String name, IdentityScope scope)Method getPublicKey() setPulicKey(Publickey key) addCertificate(Certificate certificate) removeCertificate(Certificate certificate) Certificate[] getCertificates()
Constructor Signer() Signer(String name) Signer(String name, IdentityScope scope)Method getPrivateKey() setKeyPair(KeyPair pari)
Constructor Signer() Signer(String name) Signer(String name, IdentityScope scope)Method getPrivateKey() setKeyPair(KeyPair pari)
Constructor identityScope() identityScope(String name) identityScope(String name, IdentityScope scope)Method addIdentity(Identity identity) removeIdentity(Identity identity) getIdentity(String name) getIdentity(PublicKey key) getIdentity(Principal principal) size() identites()
Constructor identityScope() identityScope(String name) identityScope(String name, IdentityScope scope)Method addIdentity(Identity identity) removeIdentity(Identity identity) getIdentity(String name) getIdentity(PublicKey key) getIdentity(Principal principal) size() identites()
34Computer Network Lab.
โข Principal ์ธํฐํ์ด์คโ Identity ๋ java.security.principal ์ธํฐํ์ด์ค๋ก
๊ตฌํโ Principal ์ ๋จ์ํ ์ด๋ฆ์ ๊ฐ์ ธ์จ๋ค
โ Methodโข public abstract String getName();
Key Holder
35Computer Network Lab.
โข Identity ํด๋์คโ ์ค์ ์ธ๊ณ์ ์ค์ฒด๋ค ( ์ฌ๋์ด๋ ์กฐ์ง๊ฐ์ ) ์ ํํโ ํค์ ์์ ์ ํ์ธโ ์ด๋ฆ , ๊ณต๊ฐํค , ๊ณต๊ฐํค๋ฅผ ์ฆ๋ช ํ๋ ์ฆ๋ช ์ ํฌํจ
โ Constructorโข public Identity (String name);
โข public Identity (String name, IdentityScope scope)
throws KeyManagementException;
Key Holder
36Computer Network Lab.
โ Method( ๊ณต๊ฐํค ๊ด๋ฆฌ )
โข public PublicKey getPublicKey ();
โข public void setPublicKey (PublicKey key)throws KeyManagementException;
( ์ฆ๋ช ์ ๊ด๋ฆฌ )
โข public void addCertificate (Certificate certificate)throws KeyManagementException;
โข public void removeCertificate (Certificate certificate)throws KeyManagementException;
โข public Certificate[] getCertificates ();
Key Holder
37Computer Network Lab.
โข Signer ํด๋์คโ ๊ฐ์ธํค ๊ด๋ฆฌ๋ฅผ ์ํด ์ถ๊ฐ๋ก ์ ๊ณต๋๋ ์๋ธํด๋์คโ Method
โข public PrivateKey getPrivateKey ();
โข public final void setKeyPair (KeyPair pair)throws InvalidParameterException KeyException;
Key Holder
38Computer Network Lab.
โข IdentityScopeโ Identity ์ ๊ทธ๋ฃน์ ํ์โ Identity ์ ๊ฐ์ฒด ์ ์ฅโ Identity ์ Scope ๋ผ๋ ๊ฐ๋ ์ ์ ์โ IdentityScope ์์ฒด๊ฐ Identity ๋ก ๋ค๋ฅธ Scope ์
์ํ ์ ์๋คโ ๊ณต๊ฐํค , ์ธ์ฆ์๋ฅผ ๊ฐ์ง์ ์๋คโ Identity ๋ก ๋ถํฐ ์์ ๋ฐ์ ํด๋์ค์ด๋ฏ๋ก Signer
์ผ์ ์๋ค
Key Holder
39Computer Network Lab.
โ Method( Identity ๊ด๋ฆฌ )
โข public abstract void addIdentity (Identity identity)throws
KeyManagementException;
โข public abstract void removeIdentity (Identity identity)throws
KeyManagementException;
โข public abstract int size ();
โข public abstract Enumeration identites ();
โข public abstract Identity getIdentity (String name);
โข public abstract Identity getIdentity (PublicKey key);
โข public Identity getIdentity (Principal principal);
Key Holder
40Computer Network Lab.
โข Key ์ Identity ๊ด๋ฆฌ ํด๋์ค์ ๊ตฌํโ java KeyManager -c keyfile signer algorithm strength
โ java KeyManager -e keyfile idname outfile
โ java KeyManager -i keyfile infile
โ java KeyManager -r keyfile idname
โ java KeyManager -l keyfile
KeyManager
41Computer Network Lab.
โข ๊ตฌํ๋ ํจ์๋คโ Constructor
protected KeyManager(String name, KeyPair pair) {
super(name);
try { setPublicKey(pair.getPublic()); }
catch (KeyManagementException kme) {}
mPrivateKey = pair.getPrivate();
mIdentities = new Hashtable();
}
KeyManager
42Computer Network Lab.
โ Name ์ Identity ํ๋public synchronized Identity getIdentity(String name) {
Enumeration e = mIdentities.elements();
while (e.hasMoreElements()) {
Identity i = (Identity)e.nextElement();
if (i.getName().equals(name))
return i;
}
return null;
}
public Identity getIdentity(PublicKey key) {
return (Identity)mIdentities.get(key); }
KeyManager
43Computer Network Lab.
โ Identity ์ถ๊ฐpublic synchronized void addIdentity(Identity identity)
throws KeyManagementException {
if(mIdentities.contains(identity))
throw new KeyManagementException("This
KeyManager already contains " + identity.getName() + ".");
if(mIdentities.containsKey(identity.getPublicKey()))throw new
KeyManagementException("This
KeyManager already contains "+ identity.getName() + "'s key.");
mIdentities.put(identity.getPublicKey(), identity);
}
KeyManager
44Computer Network Lab.
โ Identity ์ญ์
public synchronized void removeIdentity(Identity identity)
throws KeyManagementException {
PublicKey key = identity.getPublicKey();
if(mIdentities.containsKey(key))
mIdentities.remove(key);
else
throw new KeyManagementException("This KeyManager
does not contain "+ identity.getName() + ".");
}
KeyManager
45Computer Network Lab.
โ ํค ํ๋public synchronized PublicKey getPublicKey(String name) {
if(name.equals(getName()))
return getPublicKey();
return getIdentity(name).getPublicKey();
}
public PrivateKey getPrivateKey() { return mPrivateKey; }
KeyManager
46Computer Network Lab.
โ Identity ์ถ๊ฐpublic void addIdentity(String name, PublicKey key)
throws KeyManagementException {
Identity i = new KeyManagerIdentity(name);
i.setPublicKey(key);
addIdentity(i);
}
KeyManager
47Computer Network Lab.
โ ์ธ์คํด์ค ํ๋public static KeyManager getInstance(String file)
throws IOException, ClassNotFoundException {
ObjectInputStream in = new ObjectInputStream(new
FileInputStream(file));
KeyManager km = (KeyManager)in.readObject();
in.close();
km.mKeyFile = file;
return km;
}
KeyManager
48Computer Network Lab.
โ KeyManager ์์ฑ
public static KeyManager create(String file, String name, KeyPair pair) {
KeyManager km = new KeyManager(name, pair);
km.mKeyFile = file;
return km;
}
KeyManager
49Computer Network Lab.
โ ์ ์ฅpublic synchronized void save() {
try {
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream(mKeyFile));
out.writeObject(this);
out.close();
}
catch (Exception e) {
System.out.println("KeyManager.save: " + e.toString());
}
}
KeyManager
50Computer Network Lab.
โ KeyMangerIdentityprivate static class KeyManagerIdentity
extends Identity {
public KeyManagerIdentity(String name) { super(name); }
}
KeyManager
51Computer Network Lab.
โข Main ํจ์java KeyManager -c keyfile signer algorithm strength
if (option.indexOf("c") != -1) {
if (args.length < 5) { usage(); return; }
String signer = args[2]; String algorithm = args[3];
int strength = NumberFormat.getInstance().parse(args[4]).intValue();
System.out.println("Initializing the KeyPairGeneratro...");
KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm);
kpg.initialize(strength);
System.out.println("Generating the key pair...");
KeyPair pair = kpg.genKeyPair();
KeyManager km = create(keyfile, signer, pair);
km.save(); System.out.println("Done."); }
KeyManager
52Computer Network Lab.
java KeyManager -e keyfile idname outfile
else if (option.indexOf("e") != -1) {
if(args.length < 4) {usage(); return; }
String idname = args[2];
String outfile = args[3];
KeyManager km = getInstance(keyfile);
ObjectOutputStream out = new ObjectOutputStream(new
FileOutputStream(outfile));
PublicKey key = km.getPublicKey(idname);
out.writeObject(idname);
out.writeObject(key);
out.close();
System.out.println("done."); }
KeyManager
53Computer Network Lab.
java KeyManager -i keyfile infile
else if (option.indexOf("i") != -1) {if (args.length < 3) { usage(); return; }String infile = args[2];KeyManager km = getInstance(keyfile);ObjectInputStream in = new ObjectInputStream(new
FileInputStream(infile));String idname = (String)in.readObject();PublicKey key = (PublicKey)in.readObject();in.close();km.addIdentity(idname, key);km.save();System.out.println("Done.");
}
KeyManager
54Computer Network Lab.
java KeyManager -r keyfile idname
else if (option.indexOf("r") != -1) {
if (args.length < 3) { usage(); return; }
String idname = args[2];
KeyManager km = getInstance(keyfile);
Identity i = km.getIdentity(idname);
km.removeIdentity(i);
km.save();
System.out.println("done.");
}
KeyManager
55Computer Network Lab.
java KeyManager -l keyfile
else if (option.indexOf("1") != -1) {
if (args.length < 2) { usage(); return; }
KeyManager km = getInstance(keyfile);
System.out.println("KeyManager contents of " + keyfile + ":");
System.out.println(" public and private key for " +
km.getName());
Enumeration e = km.identities();
while (e.hasMoreElements()) {
Identity i = (Identity)e.nextElement();
System.out.println(" public key for " + i.getName());
}
KeyManager
56Computer Network Lab.
๋ชฉ ์ฐจ
1. ์ผ๋ฐ ์ฌํญ 2. KeyStore ๊ฐ์
2.1 KeyStore ๊ตฌ์ฑ2.2 KeyStore ๊ธฐ๋ฅ๋ค2.3 KeyStore ๋ฉ์๋ ์ค๋ช
3. keytool ๊ฐ์3.1 Keytool ๊ธฐ๋ฅ๋ค3.2 Keytool ๊ธฐ๋ฅ ์ค๋ช
4. ์ ์ฝ
57Computer Network Lab.
1. ์ผ๋ฐ ์ฌํญ
JDK1.2 API 1.1 ์์ ์ ๊ณตํ๋ ๊ณ ๊ธ๊ธฐ๋ฅ๊ณผ Public-key Encryption ์ ๋์ฑ ํ์ฅ ,
๋ณด์๊ธฐ๋ฅ ์ ๊ณต JDK1.1 ์ ํค ๊ด ๋ฆฌ ๋ identity-based ์ด ๋ฉฐ , 1.2 ๋
java.security.KeyStore ๊ธฐ๋ฐ์ผ๋ก ์๋ก์ด ๋ฉ์๋๋ฅผ ์ ๊ณต KeyStore : Private Key ์ Public Key, Certificates ๋ฅผ ๋ณด์ ํ๋
handy box ๋ก ํ ์ฌ๋์ ์ฆ๋ช ํ๊ธฐ ์ํ์ฌ ์๊ตฌ๋๋ ๋ชจ๋ ์ ๋ณด๋ฅผ ํฌํจ . ๋น์ ์ ๋ค๋ฅธ ์ด๋ค์๊ฒ ์ฆ๋ช ํ ํ์๊ฐ ์๋ค . --> ์๋ช ๋ฐ์ดํฐ ๊ฐ์ธํค
์ฌ์ฉ , ๊ณต๊ฐํค์ ์ธ์ฆ์ ์ ๊ณต ์ฌ๋๋ค์ด ํฉ๋ฒ์ ์์ ํ์ ํ๋๋ก ๋ง๋ค ํ์๊ฐ ์๋ค .
ํค๊ด๋ฆฌ ์๊ตฌ์ฌํญ ํ๋์ ๊ฐ์ธ / ๊ณต๊ฐํค ์๋ณด๋ค ๋ ๋ง์ด ์์ ํ ์ ์์ผ๋ฏ๋ก ๊ด๋ฆฌ๊ฐ
์๊ตฌ๋จ
58Computer Network Lab.
2. KeyStore ๊ฐ์
๋๊ฐ์ ์ํธ๋ฆฌ ํํ๋ฅผ ํฌํจ๊ฐ์ธํค ์ํธ๋ฆฌ (Private key entry)
๊ณต๊ฐํค์ ๋งคํ๋์ด ์ผ์นํ๋ ์ธ์ฆ์์ ์ฐ๊ณ๋ ๊ฐ์ธํค๋ฅผ ํฌํจ .
--> ๋ค๋ฅธ ๋ฐ์ดํฐ๋ฅผ ์๋ช ํ๊ณ ์ํธ ๋ถ๋ฐฐํ๋๋ฐ ์ ์ฉ
์ ์ฉ ์ฆ๋ช ์ํธ๋ฆฌ (trusted certificate entry) ๋น์ ์ด ์ฌ์ค์ ( ์ ์ฉ ) ์ ์ฆ๋ช ํ๋ ๊ฒ์ ํฌํจํ๋ค . ์ด๋ ๋ณด์ ์ ์ฑ ์ ํธ๋ฆฌํฐ , Policytool, ์ ์ฉ ์ฝ๋ ์๋ช ์์ ๋ํ ๋ณด์ ์ ์ฑ ์ ์์ ์ฐ๊ณ๋์ด ์ฌ์ฉ๋ ์ ์๋ค .
๋ณ์นญ๋ค (aliases) ๋๋ ์งง์ ์ด๋ฆ์ผ๋ก ์กฐ์ง์ํธ๋ฆฌ๋ค์ alias, Hashtable ๋๋ Properties ๊ฐ์ฒด ์์ ๊ณผ
์ ์ฌํ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ฅ๋๊ฑฐ๋ ๊ฒ์ถ .
59Computer Network Lab.
2.1 KeyStore ๊ตฌ์ฑ ๋๊ฐ์ ํค์ ์ํธ๋ฆฌ : ์ ํ๋ฆฟ ์๋ช ๊ณผ email ๋ฉ์์ง๋ค์ ์๋ช ์ธ๊ฐ์ ์๋ก ๋ค๋ฅธ ์ธ์ฆ์ฒด์ธ : Will ๊ณผ Tuck ๊ทธ๋ฆฌ๊ณ Robin ์๊ฒ
์ผ์นํ๋ ์ธ์ฆ ์ฒด์ธ (Marian ์ ์๋ ์ฌ๋๋ค์ด , ๊ทธ๋ค์ ๊ณต๊ฐํค์ ์กฐํฉํ์ฌ ์ฌ์ฉ )
๊ฐ ์ํธ๋ฆฌ์ ์๋ณ : alias ์ธ โ CodeKeysโ ๋๋ โ WillScarletโ ์
์ํ์ฌ ์๋ณํ๋ค .
EmailKeys
PublicKeyPrivateKeyCertificates
RobinHood
Certificate
WillScarlet
Certificate
FriarTuck
Certificate
KeyStore(Marianโs computer)
CodeKeys
PublicKeyPrivateKeyCertificates
์ธ๊ฐ์ ์๋ก ๋ค๋ฅธ ์ธ์ฆ์ฒด์ธ
๋๊ฐ์ ํค์ ์ํธ๋ฆฌ
( ๊ทธ๋ฆผ 5-2) KeyStore ๊ธฐ๋ฐ ํค๊ด๋ฆฌ
60Computer Network Lab.
2.2 KeyStore ๊ธฐ๋ฅ๋ค
Getting( ํ๋ ) Loading and saving( ๋ก๋ฉ๊ณผ ์ ์ฅ ) Adding private key entries ( ๊ฐ์ธํค ์ํธ๋ฆฌ ์ถ๊ฐ ) Adding trusted certificate entry( ์ ์ฉ ์ธ์ฆ ์ํธ๋ฆฌ
์ถ๊ฐ ) Retrieving entries( ์ํธ๋ฆฌ ๊ฒ์ถ )
61Computer Network Lab.
ํค๊ด๋ฆฌ ๋ฐ ์ธ์ฆ์ ๋ฐ๊ธ / ์ฆ๋ช Flow
์ธ์ฆ๊ธฐ๊ด๊ณต๊ฐํค ๋ฐ ์ธ์ฆ์ ๋ฑ๋ก๊ด๋ฆฌ
๊ณต๊ฐํค์ฌ์ฉ์ ,
์ธ์ฆ์ ์ฌ์ฉ์ ...
๊ฐ์ธ / ๊ณต๊ฐํค์์ฑ์ ,
์ธ์ฆ์ ์์ฑ์ ...
Identity-basedSinger,
Identity...
KeyStore-based...
ํค๊ด๋ฆฌ ํจ๋ฌ๋ค์
๊ณต๊ฐํค๊ธฐ๋ฐ ๋ฐ์ดํฐ ์ ์ก
๊ณต๊ฐํค ๋ถ๋ฐฐ
๊ณต๊ฐํค ๋ฑ๋ก , CSR/ ์ธ์ฆ์ ์๊ตฌ ๋ฑ๋ก
๊ณต๊ฐํค ๋ฐ ์ธ์ฆ์ ์๊ตฌ
CodeKeys,EmailKeys,Certificate...
62Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (1)
GettingKeyStore ๋ abstract class ๋ก getInstance(); ๋ฅผ
์ฌ์ฉํ์ฌ ์ค์ ์ ์ธ subclass ์ป๋๋ค . Public static final KeyStore getInstance() throws KeyStoreException
โข ์ด ๋ฉ์๋๋ KeyStore ์ธ์คํด์ค๋ฅผ ๋ฆฌํดKeyStore ์ getInstance() ๋ฉ ์ ๋ ๋ KeyStore ์
subclass ๋ฅผ ์ด๋ป๊ฒ ์์ฑํ ๊ฒ์ธ๊ฐ๋ฅผ ๊ฒฐ์ ํ๋๋ฐ java.security ์์ ํ์ผ์ ๋ผ์ธ์ผ๋ก ์ฌ์ฉํ๋ค .
๋ง์ผ ๋ผ์ธ์ด ์์ค๋๋ค๋ฉด , getInstance() ๋ก ๊ธฐ๋ณธ KeyStore ๊ตฌ ํ , sun.security.tools.JavaKeyStore ์ ์ฌ์ฉํ๋ค .
63Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (2) Loading ๊ณผ saving
loading ๊ณผ saving ์ ์ง์ , passphrase(password) ๋ฅผ ํตํ์ฌ ๋ฐ์ดํฐ์ ๋ฌด๊ฒฐ์ฑ ๊ฒ์ฌ ์ํ ํ ์ ์ฅ
public abstract void store(OutputStream stream, String password) throws IOException, NoSuchAlgotithmException, CertificateException
๋ฌด๊ฒฐ์ฑ ๊ฒ์ฌ๋ ์ ์ ํ๊ฒ ๊ตฌํ๋์๋์ง , ํค ์ ์ฅ ๋ฐ์ดํฐ์ ์์ฌ์ง ๊ฒ์ด ์๋ค๋ฉด ์ผ๋ถ ๋ณด์ฅ์ ์ ๊ณตํ์ง๋ง ์ค์ํ๋ค . ๊ฐ์ฅ ๋จ์ํ ๊ฒฝ์ฐ๋ ํค ์ ์ฅ์ ๋ฐ๋ฅด๋ KeyStore ์ ๋ฉ์์ง ๋ค์ด์ ์คํธ๋ฅผ ์ ์ฅํ๋ค .
๋ก๋ฉํ์์ ๋ KeyStoreโs ๋ฐ์ดํฐ๋ฅผ ๊ธฐ๋ฐํ ๋ฉ์์ง ๋ค์ด์ ์คํธ๋ฅผ ์ต๊ทผ์ ๊ณ์ฐ๋ ์ ์ฅ ๋ฉ์์ง ๋ค์ด์ ์คํธ์ ๋น๊ตํ ์ ์๋ค . ๊ฒฐ๊ณผ ๋ค์ด์ ์คํธ ๊ฐ์ KeyStore ์ ์ ์ฅ๋๋ค .
๋ก๋ฉ๋ ๋ ๋์ผํ ๋น๋ฐ๋ฒํธ๊ฐ ๋์ผํ ๋ค์ด์ ์คํธ ๊ฐ์ ์์ฑํ๊ธฐ ์ํ์ฌ ํ์ํ๋ค . ๋ง์ผ ๋ ๋ค์ด์ ์คํธ ๊ฐ์ด ์ผ์นํ์ง ์๋๋ค๋ฉด , ๋น๋ฐ๋ฒํธ๋ฅผ ๋ค๋ฅด๊ฒ ์ฌ์ฉํ์๊ฑฐ๋ KeyStore ๋ฐ์ดํฐ๊ฐ ๋ณ๊ฒฝ๋ ๊ฒ์ด๋ค .
64Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (3)
Adding private key entries ( ๊ฐ์ธํค ์ํธ๋ฆฌ ์ถ๊ฐ ) ๋น์ ์ด ๊ฐ์ง ํค์์ KeyStore ๋ก ์ถ๊ฐํ๊ธฐ๋ฅผ ์ํ๋ ๊ฒ์ด๋ค . ๊ณต๊ฐํค์ ๋์๋๋ ๊ฐ์ธํค์ ์ธ์ฆ์ฒด์ธ์ ์ถ๊ฐ ๊ณต๊ฐํค์ ํฌํจ๋ ๋ณธ์ธ์๋ช ์ธ์ฆ์ ๊ฐ์ง๊ณ ์๋ค๋ฉด ์ธ์ฆ์ฒด์ธ์
์ถ๊ฐ
Public abstract void setKeyEntry(String alias, PrivateKey key, String passphrase, Certificate[] chain) throws KeyStoreException
String passphrase(subclass ๊ตฌํ์ ๋ฐ๋ฅด๋ฉฐ , ์ ์ ํ ์ง์ ) Brain-dead protection : ๋จ์์คํด , KeyStore ์ ์ฅ์ ํ๋ฌธ์ passphase ์
๊ฐ์ธํค๋ฅผ ์ ์ฅ , ใ passphrase ๋ก ํค๋ณต๊ตฌ ๊ฐ๋ฅ Weak encryption : passphrase ์ ๊ฐ์ธํค๊ฐ ๊ฒฐํจ , ์คํฌ๋จ๋ธ๋ง์ ์ํด ๊ฐ์ธํค
์ํธํ . ์บ์ฃผ์ผ ์ค๋ํผ์ ์๋ง์ถ์ด ํด์ปค ๋ฐฉ์ง
65Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (4)
Strong encryption : ๊ฐ์ฅ ์ข์ ํด๊ฒฐ์ฑ ์ผ๋ก passphrase ๊ธฐ๋ฐ ์ํธํ์ ์ฌ์ฉ๋จ .( ์ 7 ์ฅ ์ฐธ์กฐ ) ์ด ์คํด์์ passphrase ๋ ์ธ์ ํค๋ฅผ ์์ฑํ๊ธฐ ์ํด ์ฌ์ฉ๋๊ณ , ์ธ์ ํค๋ ๋์นญ ์ํธ์ ์ฌ์ฉ๋๋ฉฐ , ์ด๋ KeyStore ๋ก ์ ์ฅ๋๊ธฐ ์ ์ ์ด๊ธฐ ๊ฐ์ธํค๋ฅผ ์ํธํํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ค . ์ํธํ ์๊ณ ๋ฆฌ์ฆ์ ๋ฐ๋ผ์ ์ด๋ ๊ฐ์ธํค๋ฅผ ์จ๊ธฐ๊ธฐ์ ๊ฐ์ฅ ํจ๊ณผ์ ์ผ ์ ์๋ค .
์ผ์ฐ์ด ๋ณด์ ์๋ ๊ฒ store() ์ load() ์ ๋ํ passphrase์ ์ฌ์ฉ๊ณผ๋ ๋ค๋ฆ . ์ฌ๊ธฐ์ passphrase ๋ฉ์๋๋ ์ ์ฒด ํค ์ ์ฅ ๋ฐ์ดํฐ์ ๋ฌด๊ฒฐ์ฑ์ ๋ณด์ฅํ๋ค .
66Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (5)
Adding trused certificate entry( ์ ์ฉ ์ธ์ฆ ์ํธ๋ฆฌ ์ถ๊ฐ ) setCertificateEntry() ๋ฅผ ์ฌ์ฉํ์ฌ KeyStore ๋ก ์ธ์ฆ์ ์ถ๊ฐ
Public abstract setCertificateEntry(String alias certificate Exception)โข ์ด ๋ฉ์๋๋ ์ฃผ์ด์ง ์ธ์ฆ์์ ํจ๊ป alias ๊ฐ ์ถ๊ฐ๋๋ค .โข ๋ง์ผ alias ๊ฐ ์ด๋ฏธ ์กด์ฌํ๋ค๋ฉด ์ต๊ทผ์ ์ธ์ฆ์๋ ์๋ก์ด
๊ฒ์ผ๋ก ๋์ฒด๋๋ค .
๋น์ ์ ๋ชจ๋ ์ธ์ฆ ์ฒด์ธ์ ์ถ๊ฐํ ์ ์๋ค . ๋ง์ผ ๋น์ ์ด ๋๊ตฐ๊ฐ์ ๊ณต๊ฐํค์ ์ผ์นํ๋ ์ธ์ฆ ์ฒด์ธ์ ์์ ํ๋ค๋ฉด , ๋น์ ์ ์ ์ฉ ์ธ์ฆ ์ํธ๋ฆฌ๋ก ์ฒด์ธ์ ๊ฐ ์ธ์ฆ์๋ฅผ ์ถ๊ฐํ ์ ์๋ค .
67Computer Network Lab.
2.3 KeyStore ๋ฉ์๋ ์ค๋ช (6)
Retrieving entries( ์ํธ๋ฆฌ ๊ฒ์ถ )๋ค๋ฅธ ์ฌ๋๋ค์ ๊ณต๊ฐํค์ ํฌํจํ๋ ์ธ์ฆ์๋ค์ ๋ณด์ ํจ .Get ๋ฉ์๋๋ก ๊ฒ์ถ
Public abstract PrivateKey getPrivateKey(String alias, String passphrase) throws NoSuchAlgorithmException, UnrecoverableKeyException
๋น์ ์ alias ์ ๊ด๋ จ๋ ๊ฐ์ธํค๋ฅผ ๊ฒ์ถํ๊ธฐ ์ํ์ฌ ์ด ๋ฉ์๋๋ฅผ ์ฌ์ฉํ ์ ์๋ค . ์ฃผ์ด์ง passphrase ๋ ๊ฐ์ธํค๋ฅผ ์ ์ฉํ์ฌ ๋ณดํธ (protection) ํ๋ ๊ฒ์ ์ทจ์ (undo) ํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ค .
68Computer Network Lab.
3. keytool ๊ฐ์ Keytool ์ java.security.KeyStore ํด๋์ค์ ๋ํ ๋ช ๋ น๋ผ์ธ
์ธํฐํ์ด์ค์ด๋ค . KeyStore ๊ฐ๋
๊ฐ์ธํค , ๊ณต๊ฐํค์ ์ธ์ฆ์ ๋ํ ๋จ์ database ์ด๋ฉฐ , ์ํธ๋ฆฌ๋ alias ์ผ๋ก ์๋ณ ๋ฐ ์ฐธ์กฐํ๋ค .
๊ธฐ๋ณธ์ ์ผ๋ก KeyStores ๋ hard disk ์ ํ์ผ๋ก ์ ์ฅ , ํ๋์ ํ์ผ์ด KeyStore ๋ก ์ ํฉ
keytool ํ์ฉ ( ๊ธฐ๋ณธ ๊ตฌํ์ผ๋ก ๋ณํ๋ ๊ฒ์ ) KeyStore ๋ ํ์ผ ๋ค์๊ฐ๋ฅผ ๊ด๋ฆฌํ๋๋ฐ ์ฌ์ฉ๋ ์ ์๋ค . ๋ง์ฝ ๋น์ ์ด keytool ์ ์ฌ์ฉํ ๋ KeyStore ํ์ผ์ ๋ช ์ํ์ง
์์๋ค๋ฉด ์ฌ์ ์ค์ ๋ ํ์ผ์ด ์ฌ์ฉ , ์ด๋ .keyStore ํ์ผ๋ก ๋ถ๋ฆฌ๊ฒ ๋๋ฉฐ HOMEDRIVE ์ HOMEPATH
ํ๊ฒฝ๋ณ์์ ์ํด ๊ฒฐ์ ๋ ๋๋ ํ ๋ฆฌ์ ๋์ฌ์ง๋ค . ๋๋ .keyStore ๋ JDK ์ค์น๋๋ ํ ๋ฆฌ์ ์์นํ๋ค .
69Computer Network Lab.
3.1 keytool ๊ธฐ๋ฅ๋ค
Creating a key pair( ํค์ ์์ฑ )
Ubiquitous options and defaults ( ์ด๋์๋ ์๋ ์ต์ ๊ณผ ๊ธฐ๋ณธ์ค์ )
Inspecting the KeyStore ( ํค ์ ์ฅ ๋ฉด๋ฐ๊ฒ์ฌ )
Generating a CSR(Certificate Signing Request ์์ฑ )
Importing certificates ( ์ธ์ฆ์ ๋ถ๋ฌ์ค๊ธฐ )
Other options ( ๋ค๋ฅธ ์ต์ ๋ค )
Changing the default KeyStore class ( ๊ธฐ๋ณธ์ค์ ํค ์ ์ฅ ํด๋์ค ๋ณ๊ฒฝ )
70Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (1)
Creating a key pair( ํค์ ์์ฑ )๋น์ ์ โ genkey ๋ช ๋ น ์ต์ ์ ์ฌ์ฉํ์ฌ ํค์์ ์์ฑC:\keytool โgenkey โalias Jonathan โkeyalg DSA โkeysize 1024 โdname
โCN=Jonathan Knudsen, OU=Technical Publications, O=OโReilly & Associates, C=USโ โkeypass buendia โstorepass buendia
C:\
- dname ์ด ์ํธ๋ฆฌ๋ ๋๋ ทํ ์ด๋ฆ (DN:distinguished name)* ์ ๋ช ์ ( ์ ํ์ ์ผ๋ก ์ฌ์ฉ๊ฐ๋ฅ )
CN( ๊ณต์ฉ ์ด๋ฆ ) : ๋น์ ์ ์ด๋ฆ OU( ์กฐ์ง ๋จ์ ) ๋น์ ์ด ์ํ๋ ๋น์ ์กฐ์ง์ ๋ถ์ O( ์กฐ์ง ) : ๋น์ ์ ์กฐ์ง L( ์์น ) : ํต์ , ์ S( ์ ๋ถ ) : ์ ๋ถ ๋๋ ์ฃผ C( ๋๋ผ ) : ๋๋ผ
71Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (2)
- keypass์ด ๋จ๊ณ๋ ์๋ก์ด ํค์์ ๊ฐ์ธํค๋ฅผ ๋ณดํธํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ค . ์ฃผ ) ๋๊ตฌ๋ ์ง ๋น์ ์ ์ด๊นจ ๋์ด๋ก ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณผ ์ ์์ ๊ฒ์ด๋ค . ์ถ๊ฐ์ ์ผ๋ก KeyStore ๊ตฌํ์ ์ ์ฉ๋ ์ค์ง์ ์ธ ๋ณดํธ๋ฅผ ๋น์ ์ ์ฌ์ฉํ์ฌ์ผ ํ๋ค .
- storepass์ด passphrase ๋ ์ ์ฒด ํค ์ ์ฅ์ ๋ฌด๊ฒฐ์ฑ์ ๋ณด์ฅํ๋ค . ๋๋ฌธ์ ์๋ก์ด ํค ์ ์ฅ์ ์์ฑํ๊ธฐ ์ํ์ฌ โ genkey ์ต์ ์ ์ฌ์ฉํ๋ฉฐ , ์ด ์ต์ ์ผ๋ก KeyStore ์ passphrase ๋ฅผ ์ค์ ํ๋ค . ์ดํ์ KeyStore ์ ๋ฐ๋ฅธ ๋์์ ๋์ผํ passphrase ํ์ดํ๋ฅผ ์๊ตฌํ๋ค .
72Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (3)
Ubiquitous options and defaults ( ์ด๋์๋ ์๋ ์ต์ ๊ณผ ๊ธฐ๋ณธ์ค์ )keytool ์ ๋ค์ํ ์ต์ ๋ค์ ์ด๋ ๋ช ๋ น์ด์ ํจ๊ป ์ฌ์ฉํ ์ ์๋ค . ์ด๊ฒ๋ค์ โ
keystore, -storepass, ๊ทธ๋ฆฌ๊ณ โ v๊ฐ ์๋ค .keytool ์ ๋น์ ์ด ํ์๋ก ํ๋ ๊ฒ ์ฌ๋ฌ ๊ฒฝ์ฐ์ ์์ด์ , ์ต์ ์ ์์ด๋ฒ๋ฆฌ๋๋ผ๋ ๊ธฐ๋ณธ์ค์ ์ด ์์ด์ ๊ด๋ํ๋ค . ๋ง์ผ ์๋ค๋ฉด , keytool ์ ๋น์ ์ด ์์ด๋ฒ๋ฆฐ ์ ๋ณด๋ฅผ ์ฆ์ ์๋ ค ์ค ๊ฒ์ด๋ค .
<ํ 5-1> keytool ์ต์ ๋ค์ ๊ธฐ๋ณธ์ค์ ๊ฐ
์ต์ ๊ธฐ๋ณธ ์ค์ ๊ฐ-alias mykey-keyalg DSA-keysize 1024-sigalg DSA/SHA-1-validity 90-KeyStore ๊ธฐ๋ณธ์ค์ .KeyStore ํ์ผ-file ํ์ค ์ ๋ ฅ ๋๋ ์ถ๋ ฅ
73Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (4)
Inspecting the KeyStore ( ํค ์ ์ฅ ๋ฉด๋ฐ๊ฒ์ฌ ) KeyStore ์ ๋ด์ฉ์ ๋ณด๊ธฐ ์ํ์ฌ โ list ๋ช ๋ น์ ์ฌ์ฉํ๋ค .
C:\keytool โlist โstorepass buendia
Your KeyStore contains 1 entry:
jonathan, Mon Jan 12 16:16:59 EST 1998, KeyEntry,
Certificate MD5 Fingerprint: 56:E0:FD:24:13:6c:51:C0:D9:57:B4:33:7F:79:A8:a4
C:\
โv ์ต์ ์ โ list ์ ํจ๊ป ์ฌ์ฉํ๋ค๋ฉด , ๋น์ ์ ๋ ๋ง์ ์์ธ ์ ๋ณด๋ฅผ ์ถ๋ ฅ ๊ถ๊ทน์ ์ผ๋ก ํ๋์ KeyStore ์ํธ๋ฆฌ๋ฅผ ๋ณด๊ธฐ ์ํ์ฌ โ alias ์ต์ ์ ์ฌ์ฉ .
C:\ keytool โlist โalias Jonathan โstorepass buendia
74Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (5) Generating a CSR( ์ธ์ฆ ์๋ช ์๊ตฌ์ ์์ฑ )
์ค์ ์ ์ธ ์ธ์ฆ์๋ฅผ ์ป๊ธฐ ์ํ์ฌ , ๋น์ ์ CSR ์์ฑ์ ์๊ตฌํ๋ฉด , ์ธ์ฆ ๊ธฐ๊ด (CA) ์ ์ํด ์๋ช ๋๋ค .(signed)
CSR ์ ๋น์ ์ ๊ดํ ๊ณต๊ฐํค์ ์ ๋ณด๋ฅผ ํฌํจํ๋ ํน๋ณํ ํ์ผ์ ์ด๋ ๋น์ ์ ๊ฐ์ธํค๋ก ์๋ช ๋๋ค . ๋น์ ์ด CSR ์ CA ๋ก ์ก๋ถํ ๋ , CA ๋ ๋น์ ์ ์ ์ (identity) ๋ฅผ
๊ฒ์ฌํ๊ณ CSR ์ ๊ถํ ๋ถ์ฌ๋ฅผ ์ฆ๋ช (Authenticity) ํ๊ธฐ ์ํ์ฌ ๋ ธ๋ ฅํ ๊ฒ์ด๋ค .
๊ทธ๋ฆฌ๊ณ ๋น์ ์ ์ธ์ฆํจ์ ์๋ฆฌ๊ณ , CA ์ Private key ๋ก ์๋ช ํ์ฌ , ๋น์ ์ ๊ณต๊ฐํค๋ฅผ ํ์ธ (verifies) ํ๋ค .
CSR ์ ์์ฑํ๊ธฐ ์ํ์ฌ -csr ๋ช ๋ น์ ์ ํ์ ์ผ๋ก ์ฌ์ฉํ ์์ C:\ keytool -csr -alias Jonathan -file Jonathan -file Jonathan.csr -keypass buendia -storepass buendia -vCertification request stored in file <Jonathan.csr>.Submit this to your certificate authority.
C:\
C:\ type Jonathan.csr (base64data ์ถ๋ ฅ๊ฒฐ๊ณผ page 88 ์ฐธ์กฐ )
75Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (6)
Importing certificates ( ์ธ์ฆ์ ๋ถ๋ฌ์ค๊ธฐ ) KeyStore ๋ก ์ธ์ฆ์๋ฅผ ๋ถ๋ฌ์ค๋ ๋ ๊ฐ์ง ์ด์ ๊ฐ ์กด์ฌํ๋ค .
์ฒซ๋ฒ์งธ ๊ฒฝ์ฐ , ๋น์ ์ CSR ์ ๋ํ ์๋ต์ผ๋ก CA ๋ก๋ถํฐ ์ธ์ฆ์๋ฅผ ์์ ํ ์ ์๋ค . ์ด ๊ฒฝ์ฐ์ ๋น์ ์ CSR ์ ์์ฑํ๊ธฐ ์ํ์ฌ ์ฌ์ฉํ ๊ฐ์ธํค ์ํธ๋ฆฌ๋ก ์ธ์ฆ๊ด๊ณ๋ฅผ ์๊ตฌํ ๊ฒ์ด๋ค .
๋๋ฒ์งธ ๊ฒฝ์ฐ , ๊ทธ ๋ฐ์ ๋ค๋ฅธ ์ฌ๋์ trusted certificate entry ๋ฅผ ๋ง๋ค๊ธฐ
์ํ์ฌ ์ธ์ฆ์๋ฅผ ๋ถ๋ฌ์จ๋ค .
๋ค๋ฅธ ๊ฒฝ์ฐ keytool ์ โ import ๋ช ๋ น ์ต์ ์ฌ์ฉ keytool ์ RFC1421 ์์ ๊ธฐ์ ๋ ๊ฒ๊ณผ ๊ฐ์ด โ printable encodingโ ์
๋ํด , ์ด๋ป๊ฒ X.509 ์ธ์ฆ์๋ฅผ Import ํ๋์ง๋ฅผ ์๋ค . ์ด ํฌ๋งท์ header line ๊ณผ footer line ์ด ์์ผ๋ฉฐ , body ๋ base64data ์ด๋ค .(base64์ ๊ดํ ์ข๋ ์์ธํ ์ ๋ณด๋ ์ 1 ์ฅ๊ณผ ๋ถ๋ก B ๋ฅผ ์ฐธ์กฐํ๋ค .) --> (base64data ์ถ๋ ฅ๊ฒฐ๊ณผ page 88 ์ฐธ์กฐ )
76Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (7) Other options ( ๋ค๋ฅธ ์ต์ ๋ค )
-selfcert : ๊ฐ์ธํค ์ํธ๋ฆฌ์ ๋ํ ์์ ์ ์๋ช ์ธ์ฆ์ keytool ๋ก ์ฌ์์ฑ , ๊ฐ์ธํค ์ํธ๋ฆฌ๋ฅผ ๋ณ๋์ ์ด๋ฆ (Distinguished Name) ์ผ๋ก ๋ณ๊ฒฝ , ์ต์ ์ <ํ 5-2> ์ โ genkey ์ ๊ฐ์ด ๋๋ถ๋ถ์ ๋์ผํ ์ต์ ๋ค์ ํ์ฉ
-export : ํ์ผ์ ์ธ์ฆ์๋ฅผ ๋ณด๊ด (save) ํ๊ธฐ ์ํด ๋ด๋ณด๋ธ๋ค . ์ํธ๋ฆฌ๋ฅผ ๋ช ์ํ๊ธฐ ์ํ์ฌ โ alias ์ต์ ์ ์ฌ์ฉ , ์ถ๋ ฅ ํ์ผ์ ๋ช ์ํ๊ธฐ ์ํ์ฌ โfile ์ต์ ์ ์ฌ์ฉํ๋ค .
-printcert : ํ์ผ์ ํฌํจ๋ ์ธ์ฆ์์ ๊ดํ ์ ๋ณด๋ฅผ ์ถ๋ ฅํ๋ค . ๋จ์ํ๊ฒ ํ์ผ ์ด๋ฆ์ ๋ช ์ํ๋ ๊ฒ์ โ file ์ ์ฌ์ฉํ๋ค . ์ด ๋ช ๋ น์ KeyStore ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ๋ณ๊ฒฝํ์ง ์๋๋ค .
-keyclone : ๊ฐ์ธํค ํค์ ์ฅ ์ํธ๋ฆฌ๋ฅผ ๋ณต์ฌํ๋ค . -alias, -dest, -keypass, -new ์ต์ ๋ค์ ํ์ฉํ๋ค .
77Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (8)
-storepasswd : ํค ์ ์ฅ์ ๋ํ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝํ๋ค . ๋ชจ๋ ๋ค๋ฅธ ๋ช ๋ น๋ค๊ณผ ๊ฐ์ด ์ด๊ธฐ ํค์ ์ฅ ๋น๋ฐ๋ฒํธ๋ฅผ โ storepass ๋ฅผ ์ฌ์ฉํ์ฌ ์๋ก ๋ช ์ํ๋ค . ์๋ก์ด ํค์ ์ฅ ๋น๋ฐ๋ฒํธ๋ โ new ์ต์ ์ ์ฌ์ฉํ์ฌ ๋ช ์ํ๋ค .
-keypasswd : ํค ์ ์ฅ์์ ๊ฐ์ธํค ์ํธ๋ฆฌ์ ๋ํ ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝํ๋ค . ์ด๋ <ํ 5-4> ์์ ๋์ดํ ์ต์ ๋ค์ ์ฌ์ฉํ๋ค .
-delete : ํค ์ ์ฅ์ผ๋ก๋ถํฐ ์ํธ๋ฆฌ ์ ๊ฑฐ (remove). ์ํธ๋ฆฌ๋ฅผ ๋ช ์ํ๊ธฐ ์ํด โ alias ์ต์ ์ ์ฌ์ฉํ๋ค .
-help : ์ด ๋ช ๋ น ์ต์ ์ ๋ชจ๋ keytool ์ ์ต์ ๋ค์ ๋ฆฌ์คํธ๋ฅผ ์ถ๋ ฅํ๋ค .
78Computer Network Lab.
3.2 Keytool ๊ธฐ๋ฅ์ค๋ช (9)
Changing the default KeyStore class ( ๊ธฐ๋ณธ์ค์ ํค ์ ์ฅ ํด๋์ค ๋ณ๊ฒฝ ) ๊ธฐ๋ณธ์ค์ keytool ์ sun.security.tools.JavaKeyStore ์ ์ฌ์ฉํ์ฌ
์์ฑํ๋ค . ๋ง์ผ ๋น์ ์ด ์์ ๋ง์ KeyStore ๊ตฌํ์ write ํ๋ค๋ฉด , ๋น์ ์ ๋น์ ์ ํค์ ์ธ์ฆ์๋ค์ ๊ด๋ฆฌํ๊ธฐ ์ํ์ฌ keytool ์ ์ฌ์ฉํ ์ ์๋ค . ๋น์ ์ JDK ์ค์น ๋๋ ํ ๋ฆฌ ๋ฐ์ lib/security ๋ฅผ ์ฐพ๊ณ , java.security ํ์ผ์ ํ ๋ผ์ธ์ ๋ณ๊ฒฝ์ด ํ์ํ๋ค .
KeyStore=sun.security.tools.JavaKeyStore
๋ง์ผ ๋น์ ์ KeyStore oreilly.jonathan.security.SuperDuperKeyStore ๋ก ๊ตฌํํ๋ค๋ฉด , ์์ ์ ๊ฐ์ด ๋ณ๊ฒฝ์ด ์๊ตฌ๋๋ค .
KeyStore=oreilly.jonathan.security.SuperDuperKeyStore
79Computer Network Lab.
4. ์ ์ฝ
๋ณธ 5 ์ฅ์ ํตํ์ฌ , Key ๊ด๋ฆฌ์ ๊ธฐ๋ณธ๊ฐ๋ ์ ๋ถ์ํจ
ํค์์ฑ , ๋ถ๋ฐฐ , ๋์ , identity-based, KeyStore-based ์ ๊ฐ ๋จ๊ณ์ ๊ฐ๋ ๊ณผ ํ๋ก๊ทธ๋จ์ ํ์
ํค๊ด๋ฆฌ ๋ฐ ์ธ์ฆ์ ๋ฐ๊ธ / ์ฆ๋ช Flow ์ฐธ์กฐ (7 ์ชฝ )