Package sun.security.x509

Examples of sun.security.x509.KeyUsageExtension


    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);
View Full Code Here


  
    info.set(X509CertInfo.VALIDITY, interval);
    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.
View Full Code Here

    info.set(X509CertInfo.VALIDITY, interval);
    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));
View Full Code Here

     */
    static CertStore getInstance(AccessDescription ad) {
        if (!ad.getAccessMethod().equals(AccessDescription.Ad_CAISSUERS_Id)) {
            return null;
        }
        GeneralNameInterface gn = ad.getAccessLocation().getName();
        if (!(gn instanceof URIName)) {
            return null;
        }
        URI uri = ((URIName) gn).getURI();
        try {
View Full Code Here

        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);

        NetscapeCertTypeExtension x2 = new NetscapeCertTypeExtension(bb);
        check(new DerValue(x2.getExtensionValue()).getUnalignedBitString().length(), 3);

        ReasonFlags r = new ReasonFlags(bb);
View Full Code Here

    }
   
    public X509Builder keyUsageDigitalSignature() { // other than CA or CRL;  so this applies to API clients
        try {
            v3();
             if( keyUsageExtension == null ) { keyUsageExtension = new KeyUsageExtension(); }
             keyUsageExtension.set(KeyUsageExtension.DIGITAL_SIGNATURE, true);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(keyUsageExtension.getExtensionId().toString(), keyUsageExtension);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
        }
View Full Code Here

    }

    public X509Builder keyUsageNonRepudiation() { // other than CA or CRL; this applies to API clients
        try {
            v3();
             if( keyUsageExtension == null ) { keyUsageExtension = new KeyUsageExtension(); }
             keyUsageExtension.set(KeyUsageExtension.NON_REPUDIATION, true);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(keyUsageExtension.getExtensionId().toString(), keyUsageExtension);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
        }
View Full Code Here

    }
   
    public X509Builder keyUsageKeyEncipherment() { // for encrypting and transporting other keys
        try {
            v3();
             if( keyUsageExtension == null ) { keyUsageExtension = new KeyUsageExtension(); }
             keyUsageExtension.set(KeyUsageExtension.KEY_ENCIPHERMENT, true);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(keyUsageExtension.getExtensionId().toString(), keyUsageExtension);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
        }
View Full Code Here

    }

    public X509Builder keyUsageDataEncipherment() { // for encrypting data
        try {
            v3();
             if( keyUsageExtension == null ) { keyUsageExtension = new KeyUsageExtension(); }
             keyUsageExtension.set(KeyUsageExtension.DATA_ENCIPHERMENT, true);
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(keyUsageExtension.getExtensionId().toString(), keyUsageExtension);
            info.set(X509CertInfo.EXTENSIONS, certificateExtensions);
        }
View Full Code Here

        try {
            v3();
            // certificate authority basic constraint
            BasicConstraintsExtension constraintsExtension = new BasicConstraintsExtension(true,-1); // true indicates this is a CA;  -1 means no restriction on path length;  0 or more to set a restriction on max number of certs under this one in the chain
            // certificate signing extension
            if( keyUsageExtension == null ) { keyUsageExtension = new KeyUsageExtension(); }
            keyUsageExtension.set(KeyUsageExtension.KEY_CERTSIGN, true);
            // add both
            if( certificateExtensions == null ) { certificateExtensions = new CertificateExtensions(); }
            certificateExtensions.set(keyUsageExtension.getExtensionId().toString(), keyUsageExtension);
            certificateExtensions.set(constraintsExtension.getExtensionId().toString(), constraintsExtension);
View Full Code Here

TOP

Related Classes of sun.security.x509.KeyUsageExtension

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.