Package org.mozilla.jss.asn1

Examples of org.mozilla.jss.asn1.SEQUENCE.elementAt()


      // constructor. Anyway, we do it manually...
      SEQUENCE.Template foo = new SEQUENCE.Template();
      foo.addElement(ANY.getTemplate());
      foo.addElement(ANY.getTemplate());
      SEQUENCE bar = (SEQUENCE) foo.decode(new ByteArrayInputStream(sigBytes));
      BigInteger r = new BigInteger(1, ((ANY) bar.elementAt(0)).getContents());
      BigInteger s = new BigInteger(1, ((ANY) bar.elementAt(1)).getContents());

      BigInteger e = trimHash(hash.digest(), params);
      BigInteger n = params.getOrder();
View Full Code Here


      SEQUENCE.Template foo = new SEQUENCE.Template();
      foo.addElement(ANY.getTemplate());
      foo.addElement(ANY.getTemplate());
      SEQUENCE bar = (SEQUENCE) foo.decode(new ByteArrayInputStream(sigBytes));
      BigInteger r = new BigInteger(1, ((ANY) bar.elementAt(0)).getContents());
      BigInteger s = new BigInteger(1, ((ANY) bar.elementAt(1)).getContents());

      BigInteger e = trimHash(hash.digest(), params);
      BigInteger n = params.getOrder();

      // r in [1,n-1]
View Full Code Here

        foo.addElement(new INTEGER.Template());
        foo.addElement(new OCTET_STRING.Template());

        SEQUENCE ecPrivateKey = (SEQUENCE) foo.decode(new ByteArrayInputStream(
            pki.getEncoded()));
        OCTET_STRING arrhh = (OCTET_STRING) ecPrivateKey.elementAt(1);
        return new EcPrivateKeyImpl(new BigInteger(1, arrhh.toByteArray()),
            params);
      } catch (Exception e) {
        throw new InvalidKeySpecException("Invalid key encoding", e);
      }
View Full Code Here

        byte[] data = ((X509EncodedKeySpec) keySpec).getEncoded();
        SEQUENCE ecPublicKey = (SEQUENCE) outer
            .decode(new ByteArrayInputStream(data));

        AlgorithmIdentifier algid = (AlgorithmIdentifier) ecPublicKey
            .elementAt(0);
        if (!algid.getOID().toString().equals("{1 2 840 10045 2 1}")) // ecPublicKey
          throw new IllegalArgumentException("Unsupported key");

        ECParameterSpec params = EcCore.getParams(decodeOID(algid
View Full Code Here

          throw new IllegalArgumentException("Unsupported key");

        ECParameterSpec params = EcCore.getParams(decodeOID(algid
            .getParameters()));

        BIT_STRING bs = (BIT_STRING) ecPublicKey.elementAt(1);
        data = bs.getBits();

        return new EcPublicKeyImpl(EcCore.bytesToECPoint(data, params), params);
      } catch (Exception e) {
        throw new InvalidKeySpecException("Invalid key encoding", e);
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.