Package org.apache.geronimo.crypto.asn1.x509

Examples of org.apache.geronimo.crypto.asn1.x509.GeneralNames


            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
            DEROutputStream         dOut = new DEROutputStream(bOut);
            Vector<X509Extension> values = new Vector<X509Extension>();
            Vector<DERObjectIdentifier> oids = new Vector<DERObjectIdentifier>();
          if (altNames != null) {
                GeneralNames san = CertTools.getGeneralNamesFromAltName(altNames);
                dOut.writeObject(san);
                byte[] value = bOut.toByteArray();
                X509Extension sanext = new X509Extension(false, new DEROctetString(value));
                values.add(sanext);
                oids.add(X509Extensions.SubjectAlternativeName);
View Full Code Here


        // Create some crazy extensions to see that we get them when using
        // extension override.
        // We should not get our values when not using extension override
        X509ExtensionsGenerator extgen = new X509ExtensionsGenerator();
        // SubjectAltName
        GeneralNames san = CertTools.getGeneralNamesFromAltName("dnsName=foo.bar.com");
        extgen.addExtension(X509Extensions.SubjectAlternativeName, false, san);
        // KeyUsage
        int bcku = 0;
        bcku = X509KeyUsage.decipherOnly;
        X509KeyUsage ku = new X509KeyUsage(bcku);
View Full Code Here

        "CN=testDirName|dir|name").getValues().get(0));

    String altName = "rfc822name=foo@bar.se, uri=http://foo.bar.se, directoryName="
        + LDAPDN.escapeRDN("CN=testDirName, O=Foo, OU=Bar, C=SE")
        + ", dnsName=foo.bar.se";
    GeneralNames san = CertTools.getGeneralNamesFromAltName(altName);
    GeneralName[] gns = san.getNames();
    boolean found = false;
    for (int i = 0; i < gns.length; i++) {
      int tag = gns[i].getTagNo();
      if (tag == 4) {
        found = true;
        DEREncodable enc = gns[i].getName();
        X509Name dir = (X509Name) enc;
        String str = dir.toString();
        log.debug("DirectoryName: " + str);
        assertEquals("CN=testDirName,O=Foo,OU=Bar,C=SE", str);
      }

    }
    assertTrue(found);

    altName = "rfc822name=foo@bar.se, rfc822name=foo@bar.com, uri=http://foo.bar.se, directoryName="
        + LDAPDN.escapeRDN("CN=testDirName, O=Foo, OU=Bar, C=SE")
        + ", dnsName=foo.bar.se, dnsName=foo.bar.com";
    san = CertTools.getGeneralNamesFromAltName(altName);
    gns = san.getNames();
    int dnscount = 0;
    int rfc822count = 0;
    for (int i = 0; i < gns.length; i++) {
      int tag = gns[i].getTagNo();
      if (tag == 2) {
View Full Code Here

      log.trace("<test24GetCrlDistributionPoint()");
    }
 
  public void testKrb5PrincipalName() throws Exception {
    String altName =  "krb5principal=foo/bar@P.SE, upn=upn@u.com";
    GeneralNames gn = CertTools.getGeneralNamesFromAltName(altName);

    GeneralName[] names = gn.getNames();
    String ret = CertTools.getGeneralNameString(0, names[1].getName());
    assertEquals("krb5principal=foo/bar@P.SE", ret);

    altName =  "krb5principal=foo@P.SE";
    gn = CertTools.getGeneralNamesFromAltName(altName);
    names = gn.getNames();
    ret = CertTools.getGeneralNameString(0, names[0].getName());
    assertEquals("krb5principal=foo@P.SE", ret);

    altName =  "krb5principal=foo/A.SE@P.SE";
    gn = CertTools.getGeneralNamesFromAltName(altName);
    names = gn.getNames();
    ret = CertTools.getGeneralNameString(0, names[0].getName());
    assertEquals("krb5principal=foo/A.SE@P.SE", ret);
   
    Certificate krbcert = CertTools.getCertfromByteArray(krb5principalcert);
    String s = CertTools.getSubjectAlternativeName(krbcert);
View Full Code Here

        // names
        ASN1EncodableVector extensionattr = new ASN1EncodableVector();
        extensionattr.add(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
        // AltNames
        // String[] namearray = altnames.split(",");
        GeneralNames san = CertTools.getGeneralNamesFromAltName(altnames);
        ByteArrayOutputStream extOut = new ByteArrayOutputStream();
        DEROutputStream derOut = new DEROutputStream(extOut);
        try {
            derOut.writeObject(san);
        } catch (IOException e) {
View Full Code Here

                valuevec.add(kuext);
                oidvec.add(X509Extensions.KeyUsage);    
            }
            {// Requested extensions attribute
                // AltNames
                GeneralNames san = CertTools.getGeneralNamesFromAltName("dNSName=foo.bar.com,iPAddress=10.0.0.1");
                ByteArrayOutputStream bOut = new ByteArrayOutputStream();
                DEROutputStream dOut = new DEROutputStream(bOut);
                dOut.writeObject(san);
                valuevec.add(new X509Extension(false, new DEROctetString(bOut.toByteArray())));
                oidvec.add(X509Extensions.SubjectAlternativeName);
View Full Code Here

                // SubjectAltName
                // Some altNames
                final Vector<X509Extension> values = new Vector<X509Extension>();
                final Vector<DERObjectIdentifier> oids = new Vector<DERObjectIdentifier>();
                {
                    final GeneralNames san = CertTools.getGeneralNamesFromAltName("UPN=fooupn@bar.com,rfc822Name=rfc822Name@my.com");
                    final ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
                    final DEROutputStream         dOut = new DEROutputStream(bOut);
                    dOut.writeObject(san);
                    final byte value[] = bOut.toByteArray();
                    values.add(new X509Extension(false, new DEROctetString(value)));
View Full Code Here

        challpwdattr.add(new DERSet(pwdvalues));
        // Requested extensions attribute
        ASN1EncodableVector extensionattr = new ASN1EncodableVector();
        extensionattr.add(PKCSObjectIdentifiers.pkcs_9_at_extensionRequest);
        // AltNames
        GeneralNames san = CertTools.getGeneralNamesFromAltName("dNSName=foo.bar.com,iPAddress=10.0.0.1");
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        DEROutputStream dOut = new DEROutputStream(bOut);
        try {
            dOut.writeObject(san);
        } catch (IOException e) {
View Full Code Here

        // An X509Extensions is a sequence of Extension which is a sequence of {oid, X509Extension}
        final Vector<DERObjectIdentifier> oidvec = new Vector<DERObjectIdentifier>();
        final Vector<X509Extension> valuevec = new Vector<X509Extension>();
        // Requested extensions attribute
        // AltNames
        final GeneralNames san = CertTools.getGeneralNamesFromAltName("dNSName=foo.bar.com,iPAddress=10.0.0.1");
        final ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        final DEROutputStream dOut = new DEROutputStream(bOut);
        try {
            dOut.writeObject(san);
        } catch (IOException e) {
View Full Code Here

            if(log.isDebugEnabled()) {
                log.debug("Added CRL distpoint: " + uri);
            }
            ASN1EncodableVector vec = new ASN1EncodableVector();
            vec.add(gn);
            GeneralNames gns = new GeneralNames(new DERSequence(vec));
            DistributionPointName dpn = new DistributionPointName(0, gns);
            result.add(new DistributionPoint(dpn, null, null));
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.geronimo.crypto.asn1.x509.GeneralNames

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.