Package java.security.spec

Examples of java.security.spec.DSAPublicKeySpec


    }

    /** @inheritDoc */
    public PublicKey getPublicKey() throws XMLSecurityException {
        try {
            DSAPublicKeySpec pkspec =
                new DSAPublicKeySpec(
                    this.getBigIntegerFromChildElement(
                        Constants._TAG_Y, Constants.SignatureSpecNS
                    ),
                    this.getBigIntegerFromChildElement(
                        Constants._TAG_P, Constants.SignatureSpecNS
View Full Code Here


        DERInteger x = (DERInteger)seq.getObjectAt(5);

        try {
            KeyFactory factory = KeyFactory.getInstance("DSA");

            DSAPublicKeySpec pubSpec = new DSAPublicKeySpec(
                y.getValue(),
                p.getValue(),
                q.getValue(),
                g.getValue());
            PublicKey pub = factory.generatePublic(pubSpec);
View Full Code Here

                }
                DERInteger y = (DERInteger)pkPrim;

                try {
                    KeyFactory factory = KeyFactory.getInstance("DSA");
                    DSAPublicKeySpec pubSpec = new DSAPublicKeySpec(
                        y.getValue(),
                        p.getValue(),
                        q.getValue(),
                        g.getValue());
                    return factory.generatePublic(pubSpec);
View Full Code Here

   /** @inheritDoc */
   public PublicKey getPublicKey() throws XMLSecurityException {

      try {
         DSAPublicKeySpec pkspec =
            new DSAPublicKeySpec(this
               .getBigIntegerFromChildElement(Constants._TAG_Y, Constants
               .SignatureSpecNS), this
                  .getBigIntegerFromChildElement(Constants._TAG_P, Constants
                  .SignatureSpecNS), this
                     .getBigIntegerFromChildElement(Constants._TAG_Q, Constants
View Full Code Here

                    p = params.getP();
                    q = params.getQ();
                    g = params.getG();

                    return (T) (new DSAPublicKeySpec(y, p, q, g));
                }

                if (keySpec.equals(X509EncodedKeySpec.class)) {
                    return (T) (new X509EncodedKeySpec(key.getEncoded()));
                }
View Full Code Here

                DSAPublicKey publicKey = (DSAPublicKey) key;
                DSAParams params = publicKey.getParams();

                try {
                    return engineGeneratePublic(new DSAPublicKeySpec(publicKey
                            .getY(), params.getP(), params.getQ(), params
                            .getG()));
                } catch (InvalidKeySpecException e) {
                    // Actually this exception shouldn't be thrown
                    throw new InvalidKeyException(Messages.getString(
View Full Code Here

            throws InvalidKeySpecException, NoSuchAlgorithmException {
        KeyFactory kf = KeyFactory.getInstance(algo);
        KeySpec kspec = null;
        if (algo.equalsIgnoreCase("DSA")) {
            if (number == 15) {
                kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y_15),
                        new BigInteger(DSA_P_15),
                        new BigInteger(DSA_Q_15),
                        new BigInteger(DSA_G_15));
            } else if (number == 23) {
                kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y_23),
                        new BigInteger(DSA_P_23),
                        new BigInteger(DSA_Q_23),
                        new BigInteger(DSA_G_23));
            }
        } else if (algo.equalsIgnoreCase("RSA")) {
View Full Code Here

    }

    /** @inheritDoc */
    public PublicKey getPublicKey() throws XMLSecurityException {
        try {
            DSAPublicKeySpec pkspec =
                new DSAPublicKeySpec(
                    this.getBigIntegerFromChildElement(
                        Constants._TAG_Y, Constants.SignatureSpecNS
                    ),
                    this.getBigIntegerFromChildElement(
                        Constants._TAG_P, Constants.SignatureSpecNS
View Full Code Here

    private static PublicKey getPublicKey(String algo)
            throws InvalidKeySpecException, NoSuchAlgorithmException {
        KeyFactory kf = KeyFactory.getInstance(algo);
        KeySpec kspec = null;
        if (algo.equalsIgnoreCase("DSA")) {
            kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
                        new BigInteger(DSA_P),
                        new BigInteger(DSA_Q),
                        new BigInteger(DSA_G));
        } else if (algo.equalsIgnoreCase("RSA")) {
            kspec = new RSAPublicKeySpec(new BigInteger(RSA_MOD),
View Full Code Here

        super(inboundSecurityContext, IDGenerator.generateID(null), SecurityTokenConstants.KeyIdentifier_KeyValue, true);
        this.dsaKeyValueType = dsaKeyValueType;
    }

    private PublicKey buildPublicKey(DSAKeyValueType dsaKeyValueType) throws InvalidKeySpecException, NoSuchAlgorithmException {
        DSAPublicKeySpec dsaPublicKeySpec = new DSAPublicKeySpec(
                new BigInteger(1, dsaKeyValueType.getY()),
                new BigInteger(1, dsaKeyValueType.getP()),
                new BigInteger(1, dsaKeyValueType.getQ()),
                new BigInteger(1, dsaKeyValueType.getG()));
        KeyFactory keyFactory = KeyFactory.getInstance("DSA");
View Full Code Here

TOP

Related Classes of java.security.spec.DSAPublicKeySpec

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.