Sunday, September 8, 2013
Tuesday, September 3, 2013
Oracle import dmp file
Step by Step
if not exist
1. create user {user_id} identified by {password}
2. GRANT CONNECT, DBA, RESOURCE TO {user_id};
$ imp {user_id}/{password} file={filename}.dmp ignore=y full=y
wow very Easy~
if not exist
1. create user {user_id} identified by {password}
2. GRANT CONNECT, DBA, RESOURCE TO {user_id};
$ imp {user_id}/{password} file={filename}.dmp ignore=y full=y
wow very Easy~
Sunday, September 1, 2013
Apache Benchmark
[root@dev bin]# pwd
/usr/bin
[root@dev bin]# ab -n 500 -c 20 http://{testURL}
설명 : ab –n Request개수(500) –c 동시접속자 URL (API)
== 결과값 ==
This is ApacheBench, Version 2.3
<$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology
Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation,
http://www.apache.org/
Benchmarking 203.233.82.229 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Finished 500 requests
Server
Software: Apache/2.2.21
Server
Hostname: 203.233.82.229
Server
Port: 80
Document
Path:
//account/view/terms
Document
Length: 4593 bytes
Concurrency
Level: 20 (동시 접속자)
Time taken for
tests: 0.513 seconds (총 소요시간)
Complete
requests: 500
Failed
requests: 0
Write errors:
0
Total
transferred: 2511500 bytes
HTML
transferred: 2296500 bytes
Requests per second:
975.44 [#/sec] (mean)
Time per
request: 20.504 [ms] (mean)
Time per
request: 1.025 [ms] (mean, across all
concurrent requests)
Transfer
rate: 4784.80
[Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect:
5 6 0.8
6 9
Processing:
8 14 8.3
11 124
Waiting:
7 14 8.3
11 123
Total:
13 20 8.6
17 131
Percentage of the requests served within a
certain time (ms)
50% 17
66% 19
75% 21
80% 22
90% 30
95% 34
98% 45
99% 55
100% 131 (longest
request)
Tuesday, August 27, 2013
Difference Between Connection Time out and Socket Time out~!!!
this is easy but easily fogettable
Connection Timeout is is the timeout in making the initial connection
Socket Timeout is the timeout on waiting to read data.
don't forget it~!
Connection Timeout is is the timeout in making the initial connection
Socket Timeout is the timeout on waiting to read data.
don't forget it~!
Monday, August 26, 2013
oracle query trace
1. first of all need to find session id if you use any tool loke toad or sqldeveloper
SELECT * FROM v$session
2. connect oracle by console
sqlplus '/as sysdba'
sessionid , serial
execute sys.dbms_system.set_sql_trace_in_session(1151,29373,true);
find recently maed using
ls -ltr
tkprof filename.trc customname.txt explain=user/pw sys=no
ex)tkprof neosns_ora_7274.trc t1.txt explain=neo_sns/neo_sns_dba sys=no
execute sys.dbms_system.set_sql_trace_in_session(1151,29373,false);
Wednesday, August 21, 2013
Making Secure Communication With RSA, DES [java]
Today I tried to write secure communication between client and server
i want to use ssl way
step by step I make example
and you just this process if you want secure communication
## Client ##
1. making publicKey and privateKey using RSA
2, making publicKey to Base64 String
3. give it(publicKey) to Server
## Server ##
4. receive publicKey from client and decode Bas64String to byte[]
5. get object publicKey
6. making symmetric-key (Random 16 number)
7. encryting publickey symmetric-key and give it to client
.. and
you can make encrypted message by using des or any with symmetric-key
The point is symmetric-key is exposed to only one client and one server
/**
* (c)Copyright 2010-2010, BaruSoft Co., Ltd. All rights reserved <br/>
*
* @description <br/>
*
* @create 2013. 8. 21.
* @author jjhangu
*/
package secure;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Formatter;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class RSACrypt {
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException, NoSuchProviderException, IOException {
final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
final KeyPair keyPair = generator.generateKeyPair();
final PublicKey publicKey = keyPair.getPublic();
final PrivateKey privateKey = keyPair.getPrivate();
/**
* 시나리오 1
*
* Client
* 1. make RSA keys (publicKey, priateKey)
* 2. give publicKey to Server
*
* Server
* 3. make Symmetric-key using publicKey given by client
* 4. give it to client
*
* Client and Server Communicate Using Symmetric-key using DES Algorithm
*
*/
// Client
// 1 making public and private key
final BASE64Encoder encoder = new BASE64Encoder();
final String pubKeyStr = encoder.encode(publicKey.getEncoded());
System.out.println("#######################################");
System.out.println("Client[publicKey] BASE64 ");
System.out.println("#######################################");
System.out.println(pubKeyStr);
System.out.println();
System.out.println();
final String priKeyStr = encoder.encode(privateKey.getEncoded());
System.out.println("#######################################");
System.out.println("Client[privateKey] BASE64 ");
System.out.println("#######################################");
System.out.println(priKeyStr);
System.out.println();
System.out.println();
// give it to public key to server
// Server
// 3. Get Public Key obejct
final BASE64Decoder decoder = new BASE64Decoder();
final byte[] sigBytes2 = decoder.decodeBuffer(pubKeyStr);
// PublicKey from client
final PublicKey publicServerKey = convertKeytoKeyObject(sigBytes2);
final String pubServerKeyStr = encoder.encode(publicServerKey.getEncoded());
System.out.println("#######################################");
System.out.println("Server [publicKey] BASE64 ");
System.out.println("#######################################");
System.out.println(pubServerKeyStr);
System.out.println();
System.out.println();
// 3. make Symmetric-key using publicKey given by client
final Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicServerKey);
final String symmetricKey = "0123456789ABCDEF";
System.out.println("#######################################");
System.out.println("Server [symmetricKey] ");
System.out.println("#######################################");
System.out.println(symmetricKey);
System.out.println();
System.out.println();
final byte[] b0 = cipher.doFinal(symmetricKey.getBytes());
// give symmetricKey to Client
// client decode
cipher.init(Cipher.DECRYPT_MODE, privateKey);
final byte[] b1 = cipher.doFinal(b0);
System.out.println("Client Finally Decode SymmetricKey : " + new String(b1));
// only one client and server will know symmetricKey
// and Server Client will Have Same symmetricKey and Communucating message using des
// algorithm with this symmetricKey
}
public static String bytesToHexString(byte[] bytes) {
final StringBuilder sb = new StringBuilder(bytes.length * 2);
final Formatter formatter = new Formatter(sb);
for (final byte b : bytes) {
formatter.format("%02x", b);
}
return sb.toString();
}
private static PublicKey convertKeytoKeyObject(byte[] publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
final X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(publicKey);
final KeyFactory keyFact = KeyFactory.getInstance("RSA");
return keyFact.generatePublic(x509KeySpec);
}
}
i want to use ssl way
step by step I make example
and you just this process if you want secure communication
## Client ##
1. making publicKey and privateKey using RSA
2, making publicKey to Base64 String
3. give it(publicKey) to Server
## Server ##
4. receive publicKey from client and decode Bas64String to byte[]
5. get object publicKey
6. making symmetric-key (Random 16 number)
7. encryting publickey symmetric-key and give it to client
.. and
you can make encrypted message by using des or any with symmetric-key
The point is symmetric-key is exposed to only one client and one server
/**
* (c)Copyright 2010-2010, BaruSoft Co., Ltd. All rights reserved <br/>
*
* @description <br/>
*
* @create 2013. 8. 21.
* @author jjhangu
*/
package secure;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
import java.util.Formatter;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class RSACrypt {
public static void main(String[] args) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidKeySpecException, NoSuchProviderException, IOException {
final KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
final KeyPair keyPair = generator.generateKeyPair();
final PublicKey publicKey = keyPair.getPublic();
final PrivateKey privateKey = keyPair.getPrivate();
/**
* 시나리오 1
*
* Client
* 1. make RSA keys (publicKey, priateKey)
* 2. give publicKey to Server
*
* Server
* 3. make Symmetric-key using publicKey given by client
* 4. give it to client
*
* Client and Server Communicate Using Symmetric-key using DES Algorithm
*
*/
// Client
// 1 making public and private key
final BASE64Encoder encoder = new BASE64Encoder();
final String pubKeyStr = encoder.encode(publicKey.getEncoded());
System.out.println("#######################################");
System.out.println("Client[publicKey] BASE64 ");
System.out.println("#######################################");
System.out.println(pubKeyStr);
System.out.println();
System.out.println();
final String priKeyStr = encoder.encode(privateKey.getEncoded());
System.out.println("#######################################");
System.out.println("Client[privateKey] BASE64 ");
System.out.println("#######################################");
System.out.println(priKeyStr);
System.out.println();
System.out.println();
// give it to public key to server
// Server
// 3. Get Public Key obejct
final BASE64Decoder decoder = new BASE64Decoder();
final byte[] sigBytes2 = decoder.decodeBuffer(pubKeyStr);
// PublicKey from client
final PublicKey publicServerKey = convertKeytoKeyObject(sigBytes2);
final String pubServerKeyStr = encoder.encode(publicServerKey.getEncoded());
System.out.println("#######################################");
System.out.println("Server [publicKey] BASE64 ");
System.out.println("#######################################");
System.out.println(pubServerKeyStr);
System.out.println();
System.out.println();
// 3. make Symmetric-key using publicKey given by client
final Cipher cipher = Cipher.getInstance("RSA");
cipher.init(Cipher.ENCRYPT_MODE, publicServerKey);
final String symmetricKey = "0123456789ABCDEF";
System.out.println("#######################################");
System.out.println("Server [symmetricKey] ");
System.out.println("#######################################");
System.out.println(symmetricKey);
System.out.println();
System.out.println();
final byte[] b0 = cipher.doFinal(symmetricKey.getBytes());
// give symmetricKey to Client
// client decode
cipher.init(Cipher.DECRYPT_MODE, privateKey);
final byte[] b1 = cipher.doFinal(b0);
System.out.println("Client Finally Decode SymmetricKey : " + new String(b1));
// only one client and server will know symmetricKey
// and Server Client will Have Same symmetricKey and Communucating message using des
// algorithm with this symmetricKey
}
public static String bytesToHexString(byte[] bytes) {
final StringBuilder sb = new StringBuilder(bytes.length * 2);
final Formatter formatter = new Formatter(sb);
for (final byte b : bytes) {
formatter.format("%02x", b);
}
return sb.toString();
}
private static PublicKey convertKeytoKeyObject(byte[] publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException {
final X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(publicKey);
final KeyFactory keyFact = KeyFactory.getInstance("RSA");
return keyFact.generatePublic(x509KeySpec);
}
}
Wednesday, August 7, 2013
SVN Merge
1. 먼저 원본 프로젝트에서 team->branch 생성하면 브랜치로 변경된다
2. switch 로 브랜치로 이동후 작업을 한다.
3. 다 완료하면 커밋치고
4. switch 로 원본 프로젝트 선택
5. 원본 프로젝트에서 merge 를 눌러서 머지 한다
2. switch 로 브랜치로 이동후 작업을 한다.
3. 다 완료하면 커밋치고
4. switch 로 원본 프로젝트 선택
5. 원본 프로젝트에서 merge 를 눌러서 머지 한다
Subscribe to:
Posts (Atom)