Merge "Added tests for reading: - operational data - configuration data"
[controller.git] / opendaylight / netconf / netconf-ssh / src / main / java / org / opendaylight / controller / netconf / ssh / authentication / RSAKey.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.netconf.ssh.authentication;
9
10 import ch.ethz.ssh2.signature.RSAPrivateKey;
11
12 import java.math.BigInteger;
13
14 public class RSAKey implements KeyStoreHandler {
15
16     private static RSAPrivateKey hostkey = null;
17     private static String user = "netconf";
18     private static String password = "netconf";
19     static {
20
21         BigInteger p = new BigInteger("2967886344240998436887630478678331145236162666668503940430852241825039192450179076148979094256007292741704260675085192441025058193581327559331546948442042987131728039318861235625879376246169858586459472691398815098207618446039");    //.BigInteger.probablePrime(N / 2, rnd);
22         BigInteger q = new BigInteger("4311534819291430017572425052029278681302539382618633848168923130451247487970187151403375389974616614405320169278870943605377518341666894603659873284783174749122655429409273983428000534304828056597676444751611433784228298909767"); //BigInteger.probablePrime(N / 2, rnd);
23         BigInteger phi = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));
24
25         BigInteger n = p.multiply(q);
26         BigInteger e = new BigInteger("65537");
27         BigInteger d = e.modInverse(phi);
28
29         hostkey = new RSAPrivateKey(d, e, n);
30     }
31
32     @Override
33     public RSAPrivateKey getPrivateKey() {
34         return hostkey;
35     }
36 }