Examples of DSAPublicKeySpec


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), this
                     .getBigIntegerFromChildElement(Constants._TAG_Q, Constants
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

         try {
            if ("ssh-rsa".equals(type)) {
               RSAPublicKeySpec spec = SshKeys.publicKeySpecFromOpenSSH(input);
               return KeyFactory.getInstance("RSA").generatePublic(spec);
            } else if ("ssh-dss".equals(type)) {
               DSAPublicKeySpec spec = DSAKeys.publicKeySpecFromOpenSSH(input);
               return KeyFactory.getInstance("DSA").generatePublic(spec);
            } else {
               throw new IllegalArgumentException("bad format, should be: [ssh-rsa|ssh-dss] AAAAB3...");
            }
         } catch (InvalidKeySpecException ex) {
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

      checkArgument("ssh-dss".equals(marker), "looking for marker ssh-dss but got %s", marker);
      BigInteger p = new BigInteger(readLengthFirst(stream));
      BigInteger q = new BigInteger(readLengthFirst(stream));
      BigInteger g = new BigInteger(readLengthFirst(stream));
      BigInteger y = new BigInteger(readLengthFirst(stream));
      return new DSAPublicKeySpec(y, p, q, g);
   }
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

    * @param publicKeyOpenSSH RSA public key in OpenSSH format
    * @return fingerprint ex.
    *         {@code 2b:a9:62:95:5b:8b:1d:61:e0:92:f7:03:10:e9:db:d9}
    */
   public static String fingerprintPublicKey(String publicKeyOpenSSH) {
      DSAPublicKeySpec publicKeySpec = publicKeySpecFromOpenSSH(publicKeyOpenSSH);
      return fingerprint(publicKeySpec.getP(), publicKeySpec.getQ(), publicKeySpec.getG(), publicKeySpec.getY());
   }
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

   }

   @Test
   public void testEncodeAsOpenSSH() throws IOException, InvalidKeySpecException, NoSuchAlgorithmException {
      String dsa = Strings2.toStringAndClose(getClass().getResourceAsStream("/ssh-dsa.txt"));
      DSAPublicKeySpec spec = DSAKeys.publicKeySpecFromOpenSSH(dsa);
      DSAPublicKey key = (DSAPublicKey) KeyFactory.getInstance("DSA").generatePublic(spec);

      assertEquals(DSAKeys.encodeAsOpenSSH(key), dsa);
   }
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

      seed = new DOMCryptoBinary(curElem.getFirstChild());
      curElem = DOMUtils.getNextSiblingElement(curElem);
      pgen = new DOMCryptoBinary(curElem.getFirstChild());
  }
  //@@@ do we care about j, pgenCounter or seed?
  DSAPublicKeySpec spec = new DSAPublicKeySpec
      (y.getBigNum(), p.getBigNum(), q.getBigNum(), g.getBigNum());
        return (DSAPublicKey) generatePublicKey(dsakf, spec);
    }
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

    * @throws XMLSecurityException
    */
   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

Examples of java.security.spec.DSAPublicKeySpec

                    if (pos != rawKey.length) {
                        throw new IOException("Authorized keys file line " + reader.getLineNumber() + " contains a DSA key with extra garbage.");
                    }

                    DSAPublicKeySpec ps = new DSAPublicKeySpec(y, p, q, g);
                    pk = dsaKeyGen.generatePublic(ps);
                } else if (tokens[0].equals("ssh-rsa")) {
                    int pos = 11;

                    int n = getInt(rawKey, pos);
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

      seed = new DOMCryptoBinary(curElem.getFirstChild());
      curElem = DOMUtils.getNextSiblingElement(curElem);
      pgen = new DOMCryptoBinary(curElem.getFirstChild());
  }
  //@@@ do we care about j, pgenCounter or seed?
  DSAPublicKeySpec spec = new DSAPublicKeySpec
      (y.getBigNum(), p.getBigNum(), q.getBigNum(), g.getBigNum());
        return (DSAPublicKey) generatePublicKey(dsakf, spec);
    }
View Full Code Here

Examples of java.security.spec.DSAPublicKeySpec

                    if (pos != rawKey.length) {
                        throw new IOException("Authorized keys file line " + reader.getLineNumber() + " contains a DSA key with extra garbage.");
                    }

                    DSAPublicKeySpec ps = new DSAPublicKeySpec(y, p, q, g);
                    pk = dsaKeyGen.generatePublic(ps);
                } else if (tokens[0].equals("ssh-rsa")) {
                    int pos = 11;

                    int n = getInt(rawKey, pos);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.