Package java.security.spec

Examples of java.security.spec.DSAPrivateKeySpec


    public static PrivateKey getPrivateKey(String algo)
        throws InvalidKeySpecException, NoSuchAlgorithmException {
        KeyFactory kf = KeyFactory.getInstance(algo);
        KeySpec kspec;
        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));
View Full Code Here


        BigQ = new BigInteger(1, massage(Base64.decode(new String(q))));
        BigG = new BigInteger(1, massage(Base64.decode(new String(g))));

        try {
            KeyFactory dsaKeyFactory = KeyFactory.getInstance("dsa");
            DSAPrivateKeySpec kspec = new DSAPrivateKeySpec(BigY, BigP, BigQ, BigG);
            return (DSAPrivateKey) dsaKeyFactory.generatePrivate(kspec);
        } catch (Exception e) {
            throw new ProcessingException(e);
        }
    }
View Full Code Here

TOP

Related Classes of java.security.spec.DSAPrivateKeySpec

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.