Package sun.security.x509

Examples of sun.security.x509.GeneralNames


        }

        SubjectAlternativeNameExtension altNameExt =
            certImpl.getSubjectAlternativeNameExtension();
        if (altNameExt != null) {
            GeneralNames altNames =
                (GeneralNames)altNameExt.get(altNameExt.SUBJECT_NAME);
            /* see if any alternative name matches target */
            if (altNames != null) {
                for (int j = 0, n = altNames.size(); j < n; j++) {
                    GeneralNameInterface altName = altNames.get(j).getName();
                    if (altName.equals(target)) {
                        return 0;
                    }
                }
            }
View Full Code Here


public class NamedBitList {
    public static void main(String[] args) throws Exception {

        boolean[] bb = (new boolean[] {true, false, true, false, false, false});
        GeneralNames gns = new GeneralNames();
        gns.add(new GeneralName(new DNSName("dns")));
        DerOutputStream out;

        // length should be 5 since only {T,F,T} should be encoded
        KeyUsageExtension x1 = new KeyUsageExtension(bb);
        check(new DerValue(x1.getExtensionValue()).getUnalignedBitString().length(), 3);
View Full Code Here

        // Parse issuerSerial, if present
        if (certId.data.available() > 0) {
            DerValue issuerSerial = certId.data.getDerValue();
            // Parse issuer
            issuer = new GeneralNames(issuerSerial.data.getDerValue());
            // Parse serialNumber
            serialNumber = new SerialNumber(issuerSerial.data.getDerValue());
        }
    }
View Full Code Here

                alternativeName = ip.substring(3);
            }
            //                InetAddress ipAddress = new InetAddress.getByName(alternativeName.substring(3));
            //                IPAddressName ipAddressName = new IPAddressName(ipAddress.getAddress());
            IPAddressName ipAddressName = new IPAddressName(alternativeName);
            if( alternativeNames == null ) { alternativeNames = new GeneralNames(); }
            alternativeNames.add(new GeneralName(ipAddressName));
            SubjectAlternativeNameExtension san = new SubjectAlternativeNameExtension(alternativeNames);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(san.getExtensionId().toString(), san);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
View Full Code Here

            String alternativeName = dns;
            if (dns.startsWith("dns:")) {
                alternativeName = dns.substring(4);
            }
            DNSName dnsName = new DNSName(alternativeName);
            if( alternativeNames == null ) { alternativeNames = new GeneralNames(); }
            alternativeNames.add(new GeneralName(dnsName));
            SubjectAlternativeNameExtension san = new SubjectAlternativeNameExtension(alternativeNames);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(san.getExtensionId().toString(), san);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
View Full Code Here

                new Vector<ObjectIdentifier>(Arrays.asList(new ObjectIdentifier("1.3.6.1.5.5.7.3.1")))));

        if (san != null) {
            int colonpos;
            String[] ps = san.split(",");
            GeneralNames gnames = new GeneralNames();
            for(String item: ps) {
                colonpos = item.indexOf(':');
                if (colonpos < 0) {
                    throw new IllegalArgumentException("Illegal item " + item + " in " + san);
                }
                String t = item.substring(0, colonpos);
                String v = item.substring(colonpos+1);
                gnames.add(createGeneralName(t, v));
            }
            // Non critical
            ext.set(SubjectAlternativeNameExtension.NAME, new SubjectAlternativeNameExtension(false, gnames));
        }
View Full Code Here

      nc = null;
        } else {
            ncBytes = (byte []) bytes.clone();
            // validate DER encoding
      try {
                nc = new NameConstraintsExtension(Boolean.FALSE, bytes);
      } catch (IOException ioe) {
    IllegalArgumentException iae =
        new IllegalArgumentException(ioe.getMessage());
    iae.initCause(ioe);
    throw iae;
View Full Code Here

            nc = null;
        } else {
            ncBytes = bytes.clone();
            // validate DER encoding
            try {
                nc = new NameConstraintsExtension(Boolean.FALSE, bytes);
            } catch (IOException ioe) {
                IllegalArgumentException iae =
                    new IllegalArgumentException(ioe.getMessage());
                iae.initCause(ioe);
                throw iae;
View Full Code Here

                        + principal.getPassword() + "\n");
                }
                // SIGNATURE
                if( ( action & WSConstants.SIGN ) > 0 ){
                    X509Certificate cert = secRes.getCertificate();
                    X500Name principal = (X500Name) secRes.getPrincipal();
                    // Do something whith cert
                    System.out.print("Signature for : "  + principal.getCommonName());
                }
            }
        }
    }
View Full Code Here

      keypair = new CertAndKeyGen(keyAlgName, sigAlgName, providerName);

      keypair.generate(keysize);

      PrivateKey privKey = keypair.getPrivateKey();
      X500Name x500name = new X500Name("CN=" + name);
     
      X509Certificate cert
        = keypair.getSelfCertificate(x500name, days * 24 * 3600);

      return new SelfSignedCert(cert, privKey);
View Full Code Here

TOP

Related Classes of sun.security.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.