/** * Client_Key_Exchangeを受け取ったときの動作をします。 * * @param line クライアントから受信した文字列 * @throws CertificateException * @throws IOException * @throws KeyStoreException * @throws NoSuchAlgorithmException * @throws UnrecoverableKeyException * @author kinbara */ private void recieveClientKeyExchange(String line) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { X509 x509 = new X509("src/sglserver/conf/key/ca", "CAKeyStore", this.storePasswd); RSAPrivateKey sk = x509.getRSAPrivateKey("server", this.keyPasswd); // 暗号化されたプリマスターシークレットの抽出 line = line.substring(line.indexOf(":") + 1); BigInteger preCipher = new BigInteger(line, 16); // プリマスターシークレットを復号 preMastarSecret = preCipher.modPow(sk.getPrivateExponent(), sk.getModulus()); // (事前共有鍵)=(秘密鍵). modPow((s乗:すなわちaのs乗),(元:すなわちg)) // b = a.modPow(s, n); a mod n のs乗がbに代入される }