Package org.apache.geronimo.crypto.asn1

Examples of org.apache.geronimo.crypto.asn1.DERObject


            try
            {
                bIn = new ByteArrayInputStream(bytes);
                aIn = new ASN1InputStream(bIn);

                DERObject   obj = aIn.readObject();
   
                return new SimpleTestResult(false, getName() + ": test " + id + " length mismatch - expected " + sample.length + System.getProperty("line.separator") + ASN1Dump.dumpAsString(info) + " got " + bytes.length + System.getProperty("line.separator") + ASN1Dump.dumpAsString(obj));
            }
            catch (Exception e)
            {
View Full Code Here


      e.printStackTrace();
    }
   
    // javni kljuc se sastoji od modula i javnog eksponenta u odgovarajucoj ASN1 strukturi
    ASN1InputStream is = new ASN1InputStream(x509Cert.getPublicKey().getEncoded());
      DERObject obj = null;
    try {
      obj = is.readObject();
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

    RSAPrivateCrtKeySpec privKeySpec = null;
    ASN1InputStream asn1InputStream = new ASN1InputStream(privateKey);
    //parsiranje ASN1 strukture
    ArrayList<BigInteger> privateKeyParts = new ArrayList<BigInteger>();
    try {
      DERObject derObject = asn1InputStream.readObject();
      ASN1Sequence asn1Seq = (ASN1Sequence) derObject;
     
      Enumeration<DERObject> en = asn1Seq.getObjects();
      while(en.hasMoreElements()){
        DERObject obj = en.nextElement();
        DERBitString bitString = DERBitString.getInstance(obj);
        byte[] prependZero = new byte[bitString.getBytes().length+1];
        // zbog "cudnog" BigInteger konstruktora mora se dodati 0x0 na pocetak,
        // u suprotnom u pojedinim slucajevima pogresno se protumaci znak i brojevi ispadnu negativni
        prependZero[0] = 0x0;
        System.arraycopy(bitString.getBytes(), 0, prependZero, 1, bitString.getBytes().length);
        privateKeyParts.add(new BigInteger(prependZero));
      }

      // citamo sertifikat zbog podataka o javnom kljucu
      byte[] standardFileBytes = readElementaryFile(STANDARD_CERTIFICATE);
      byte[] certificateBytes = new byte[standardFileBytes.length];
      System.arraycopy(standardFileBytes, 4, certificateBytes, 0, standardFileBytes.length-4);
      ByteArrayInputStream certificateInputStream = new ByteArrayInputStream(certificateBytes);
      CertificateFactory cf = CertificateFactory.getInstance("X.509");
      X509Certificate x509Cert = (X509Certificate) cf.generateCertificate(certificateInputStream);
     
      // javni kljuc se sastoji od modula i javnog eksponenta u odgovarajucoj ASN1 strukturi
      ASN1InputStream is = new ASN1InputStream(x509Cert.getPublicKey().getEncoded());
        DERObject obj = is.readObject();
        ASN1Sequence seq = (ASN1Sequence)obj;
        SubjectPublicKeyInfo pkInfo = SubjectPublicKeyInfo.getInstance(seq);
        RSAPublicKeyStructure pubk = RSAPublicKeyStructure.getInstance(pkInfo.getPublicKey());
        BigInteger expo = pubk.getPublicExponent();
        BigInteger mod = pubk.getModulus();
View Full Code Here

            ASN1InputStream din = new ASN1InputStream(new ByteArrayInputStream(contentsKey));

            //
            // Basic checks to make sure it's a PKCS#7 SignedData Object
            //
            DERObject pkcs;

            try {
                pkcs = din.readObject();
            }
            catch (IOException e) {
View Full Code Here

     * @throws CertificateParsingException on error
     * @since  2.1.6
     */
    public static String getOCSPURL(X509Certificate certificate) throws CertificateParsingException {
        try {
            DERObject obj = getExtensionValue(certificate, X509Extensions.AuthorityInfoAccess.getId());
            if (obj == null) {
                return null;
            }

            ASN1Sequence AccessDescriptions = (ASN1Sequence) obj;
View Full Code Here

        if (!(obj instanceof X509Name || obj instanceof ASN1Sequence))
        {
            return false;
        }

        DERObject derO = ((DEREncodable)obj).getDERObject();

        if (this.getDERObject().equals(derO))
        {
            return true;
        }
View Full Code Here

        if (!(obj instanceof X509Name || obj instanceof ASN1Sequence))
        {
            return false;
        }
       
        DERObject derO = ((DEREncodable)obj).getDERObject();
       
        if (this.getDERObject().equals(derO))
        {
            return true;
        }
View Full Code Here

    {
        String value = Strings.toLowerCase(s.trim());
       
        if (value.length() > 0 && value.charAt(0) == '#')
        {
            DERObject obj = decodeObject(value);

            if (obj instanceof DERString)
            {
                value = Strings.toLowerCase(((DERString)obj).getString().trim());
            }
View Full Code Here

    {
        int index = 0;

        // TODO
        // "It MUST be set to 0."
        DERObject tmp = seq.getObjectAt(index++).getDERObject();
        version = (DERInteger)tmp;

        tmp = seq.getObjectAt(index++).getDERObject();
        if (tmp instanceof ASN1TaggedObject)
        {
View Full Code Here

        DistributionPoint dp,
        Object cert,
        X509CRL crl)
        throws AnnotatedException
    {
        DERObject idp = CertPathValidatorUtilities.getExtensionValue(crl, ISSUING_DISTRIBUTION_POINT);
        boolean isIndirect = false;
        if (idp != null)
        {
            if (IssuingDistributionPoint.getInstance(idp).isIndirectCRL())
            {
View Full Code Here

TOP

Related Classes of org.apache.geronimo.crypto.asn1.DERObject

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.