Package java.security.spec

Examples of java.security.spec.RSAPrivateKeySpec


        if (algo.equalsIgnoreCase("DSA")) {
            kspec = new DSAPrivateKeySpec
                (new BigInteger(DSA_X), new BigInteger(DSA_P),
                 new BigInteger(DSA_Q), new BigInteger(DSA_G));
        } else if (algo.equalsIgnoreCase("RSA")) {
            kspec = new RSAPrivateKeySpec
                (new BigInteger(RSA_MOD), new BigInteger(RSA_PRIV));
        } else throw new RuntimeException("Unsupported key algorithm " + algo);
        return kf.generatePrivate(kspec);
    }
View Full Code Here


        BigInteger bigModulus = new BigInteger(1, massage(Base64.decode(new String(modulus))));
        BigInteger bigEx = new BigInteger(1, massage(Base64.decode(new String(exponent))));

        try {
            KeyFactory rsaKeyFactory = KeyFactory.getInstance("rsa");
            RSAPrivateKeySpec kspec = new RSAPrivateKeySpec(bigModulus,bigEx);
            return (RSAPrivateKey) rsaKeyFactory.generatePrivate(kspec);
        } catch (Exception e) {
            throw new ProcessingException(e);
        }
    }
View Full Code Here

    }
   
    BigInteger modulus = n.decodeToBigInteger();
    BigInteger privateExponent = d.decodeToBigInteger();
   
    RSAPrivateKeySpec spec;

    if (p == null) {
      // Use 1st representation
      spec = new RSAPrivateKeySpec(modulus, privateExponent);

    } else {
      // Use 2nd (CRT) representation
      BigInteger publicExponent = e.decodeToBigInteger();
      BigInteger primeP = p.decodeToBigInteger();
View Full Code Here

TOP

Related Classes of java.security.spec.RSAPrivateKeySpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.