Package com.itextpdf.text.pdf.security

Examples of com.itextpdf.text.pdf.security.CertificateInfo$X500Name


        boolean success = false;
        try {
            if (certs != null) {
                Subject subject = new Subject();
                X509Certificate certificate = certs[0];
                X500Name x500Name = (X500Name) certificate.getSubjectDN();
                subject.getPublicCredentials().add(x500Name);
                // Put the certificate chain as an List in the subject, to be accessed by user's LoginModule.
                final List<X509Certificate> certificateCred = Arrays.asList(certs);
                subject.getPublicCredentials().add(certificateCred);
                LoginContextDriver.doX500Login(subject, moduleID);
View Full Code Here


     * @param dn like "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US"
     * @return
     */
    public X509Builder subjectName(String dn) {
        try {
            certificateSubjectName = new CertificateSubjectName(new X500Name(dn));
            info.set(X509CertInfo.SUBJECT, certificateSubjectName); // CertificateException, IOException
        }
        catch(Exception e) {
            fault(e, "subjectName(%s)", dn);
        }
View Full Code Here

        }
        return this;
    }
   
    public X509Builder issuerName(X509Certificate issuerCertificate) {
        X500Name issuerName = X500Name.asX500Name(issuerCertificate.getSubjectX500Principal());
        issuerName(issuerName);
        return this;
    }
View Full Code Here

        return this;
    }

    public X509Builder issuerName(String dn) {
        try {
            certificateIssuerName = new CertificateIssuerName(new X500Name(dn));
            info.set(X509CertInfo.ISSUER, certificateIssuerName); // CertificateException, IOException
        }
        catch(Exception e) {
            fault(e, "issuerName(%s)", dn);
        }
View Full Code Here

            randomSerial();
        }
        if( certificateSubjectName == null ) {
            if( commonName != null || organizationUnit != null || organizationName != null || country != null ) {
                try {
                    subjectName(new X500Name(commonName, organizationUnit, organizationName, country));
                }
                catch(Exception e) {
                    fault(e, "commonName(%s) organizationUnit(%s) organizationName(%s) country(%s)", commonName, organizationUnit, organizationName, country);
                }
            }
        }
        if( certificateIssuerName == null ) {
            //if( certificateSubjectName != null ) { // assume self-signed ?? or check if we have an issuer cert first ???
            // XXX TODO
            //}
            if( commonName != null || organizationUnit != null || organizationName != null || country != null ) {
                try {
                    issuerName(new X500Name(commonName, organizationUnit, organizationName, country));
                }
                catch(Exception e) {
                    fault(e, "commonName(%s) organizationUnit(%s) organizationName(%s) country(%s)", commonName, organizationUnit, organizationName, country);
                }
            }
View Full Code Here

      throw new CertificateException("Failed to generate certificate: "+ e.getMessage(), e);
    }
  }

  private CertificateSigner createCertificateSigner(X500Principal issuer, PrivateKey issuerPrivate) throws IOException, GeneralSecurityException {
    final X500Name issuerName = new X500Name(issuer.getName());
    final Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
    signature.initSign(issuerPrivate);
    return new CertificateSigner(signature, issuerName);
  }
View Full Code Here

    return new CertificateSigner(signature, issuerName);
  }

  private X509CertInfo createCertificateInfo(X500Principal subject, PublicKey subjectPublic, X500Principal issuer, PublicKey issuerPublic, CertificateValidity validity, CertificateSigner signer) throws IOException, GeneralSecurityException {
    final BigInteger serialNumber = getNextSerialNumber();
    final X500Name subjectName = new X500Name(subject.getName());
    final X509CertInfo info = new X509CertInfo();

    // Add all mandatory attributes
    info.set(X509CertInfo.VERSION, new CertificateVersion(
        CertificateVersion.V3));
View Full Code Here

        final Subject fs = subject;

        String userName = "";
        try {
            final X500Name x500Name = new X500Name(
                x500Principal.getName(X500Principal.RFC1779));
            userName = x500Name.toString();

            AppservAccessController.doPrivileged(new PrivilegedAction(){
                public java.lang.Object run(){
                    fs.getPublicCredentials().add(x500Name);
                    return fs;
View Full Code Here

            _logger.fine("Processing X.500 name login.");
       }
       String user = null;
       String realm_name = null;
       try{
            X500Name x500name = (X500Name)getPublicCredentials(s, X500Name.class);
            user = x500name.getName();
       
            // In the RI-inherited implementation this directly creates
            // some credentials and sets the security context. This means
            // that the certificate realm does not get an opportunity to
            // process the request. While the realm will not do any
View Full Code Here

        DirContext ctx = null;
        String srcFilter = null;
        try {
            ctx = new InitialDirContext(getLdapBindProps());

            X500Name name = new X500Name(userDN);
            String _username = name.getCommonName();
            if (_username == null && userDN != null && userDN.startsWith("uid")) {
                //handle uid=XXX here where cn is not present
                //TODO :maybe there is a better way to handle this??
                int first = userDN.indexOf("uid=");
                int last = userDN.indexOf(",");
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.security.CertificateInfo$X500Name

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.