Package sun.security.x509

Examples of sun.security.x509.RDN


   */
  public String getUserCertificateCN()
     throws CertificateEncodingException
  {
    X500Name x500name = new JcaX509CertificateHolder(userCertificate).getSubject();
    RDN cn = x500name.getRDNs(BCStyle.CN)[0];

    return IETFUtils.valueToString(cn.getFirst().getValue());
  }
View Full Code Here


   */
  public String getUserCertificateOrg()
     throws CertificateEncodingException
  {
    X500Name x500name = new JcaX509CertificateHolder(userCertificate).getSubject();
    RDN org = x500name.getRDNs(BCStyle.O)[0];

    return IETFUtils.valueToString(org.getFirst().getValue());
  }
View Full Code Here

    return digestType;
  }

  protected String getValue(final X509Principal principal) {
    X500Name x500Name = new X500Name(principal.getName());
    RDN rdn = x500Name.getRDNs(BCStyle.CN)[0];
    return IETFUtils.valueToString(rdn.getFirst().getValue());
  }
View Full Code Here

    return IETFUtils.valueToString(rdn.getFirst().getValue());
  }

  protected String getValue(final X500Principal principal) {
    X500Name x500Name = new X500Name(principal.getName());
    RDN rdn = x500Name.getRDNs(BCStyle.CN)[0];
    return IETFUtils.valueToString(rdn.getFirst().getValue());
  }
View Full Code Here

      KeyStore userKeyStore = UserConfig.getUserKeyStore();
      X509Certificate currentCertificate = (X509Certificate) userKeyStore.getCertificate(CipherParams.CERTIFICATE_IDENTIFIER);
     
      if (currentCertificate != null) {
        X500Name currentCertificateSubject = new JcaX509CertificateHolder(currentCertificate).getSubject();
        RDN currentCertificateSubjectCN = currentCertificateSubject.getRDNs(BCStyle.CN)[0];

        String currentCertificateSubjectCnStr = IETFUtils.valueToString(currentCertificateSubjectCN.getFirst().getValue());
       
        if (!certificateCommonName.equals(currentCertificateSubjectCnStr)) {
          logger.log(Level.INFO, "- Certificate regeneration necessary: Cert common name in daemon config changed from " + currentCertificateSubjectCnStr + " to " + certificateCommonName + ".");
          return true;
        }       
View Full Code Here

    info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(sn));
    info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
    info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
    info.set(X509CertInfo.KEY, new CertificateX509Key(pair.getPublic()));
    info.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3));
    AlgorithmId algo = new AlgorithmId(AlgorithmId.md5WithRSAEncryption_oid);
    info.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(algo));
  
    // Sign the cert to identify the algorithm that's used.
    X509CertImpl cert = new X509CertImpl(info);
    cert.sign(privkey, algorithm);
View Full Code Here

        // other solution: We first sign the cert, then retrieve the
        // outer sigalg and use it to set the inner sigalg

        X509CertImpl newCert = new X509CertImpl(certInfo);
        newCert.sign(privKey, sigAlgName);
        AlgorithmId sigAlgid = (AlgorithmId)newCert.get(X509CertImpl.SIG_ALG);
        certInfo.set(CertificateAlgorithmId.NAME + "." +
                     CertificateAlgorithmId.ALGORITHM, sigAlgid);

        // Sign the new certificate
        newCert = new X509CertImpl(certInfo);
View Full Code Here

    info.set(X509CertInfo.SUBJECT, new CertificateSubjectName(owner));
    info.set(X509CertInfo.ISSUER, new CertificateIssuerName(owner));
    info.set(X509CertInfo.KEY, new CertificateX509Key(pair.getPublic()));
    info
      .set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3));
    AlgorithmId algo = new AlgorithmId(AlgorithmId.md5WithRSAEncryption_oid);
    info.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(algo));

    // Sign the cert to identify the algorithm that's used.
    X509CertImpl cert = new X509CertImpl(info);
    cert.sign(privkey, algorithm);
View Full Code Here

        // (as defined in PKCS#8)
        AlgorithmParameters pbeParams =
            AlgorithmParameters.getInstance("PBE", PROV);
        pbeParams.init(pbeSpec);

        AlgorithmId encrAlg = new AlgorithmId
            (new ObjectIdentifier(PBE_WITH_MD5_AND_DES3_CBC_OID), pbeParams);
        return new EncryptedPrivateKeyInfo(encrAlg,encrKey).getEncoded();
    }
View Full Code Here

                                           encrInfo.getEncryptedData().length);
            }

            // determine the private-key algorithm, and parse private key
            // using the appropriate key factory
            String oidName = new AlgorithmId
                (new PrivateKeyInfo(plain).getAlgorithm().getOID()).getName();
            KeyFactory kFac = KeyFactory.getInstance(oidName);
            return kFac.generatePrivate(new PKCS8EncodedKeySpec(plain));

        } catch (NoSuchAlgorithmException ex) {
View Full Code Here

TOP

Related Classes of sun.security.x509.RDN

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.