Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
BEGIN LICENSE BLOCK ***** Version: CPL 1.0/GPL 2.0/LGPL 2.1 The contents of this file are subject to the Common Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.eclipse.org/legal/cpl-v10.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. Copyright (C) 2006 Ola Bini <ola@ologix.com> Alternatively, the contents of this file may be used under the terms of either of the GNU General Public License Version 2 or later (the "GPL"), or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), in which case the provisions of the GPL or the LGPL are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of either the GPL or the LGPL, and not to allow others to use your version of this file under the terms of the CPL, indicate your decision by deleting the provisions above and replace them with the notice and other provisions required by the GPL or the LGPL. If you do not delete the provisions above, a recipient may use your version of this file under the terms of any one of the CPL, the GPL or the LGPL. END LICENSE BLOCK ***
 
 package org.jruby.ext.openssl.x509store;
 
 import java.util.Date;
 
 import java.util.List;
 
 import  org.bouncycastle.asn1.DERObject;

c: X509_VERIFY_PARAM

Author(s):
Ola Bini
 
 public class VerifyParameter {
     public String name;
     public Date checkTime;
     public long inheritFlags;
     public long flags;
     public int purpose;
     public int trust;
     public int depth;
     public List<DERObject> policies;

    
c: X509_VERIFY_PARAM_new
 
     public VerifyParameter() { 
         zero();
     }
 
     public VerifyParameter(String nlong tlong i_flong fint pint trsint dList<DERObject> pol) {
         this. = n;
         this. = new Date(t);
         this. = i_f;
         this. = f;
         this. = p;
         this. = trs;
         this. = d;
         this. = pol;
     }
 
     private void zero() {
          = null;
          = 0;
          = 0;
          = 0;
          = -1;
          = null;
     }

    
c: X509_VERIFY_PARAM_free
 
     public void free() {
         zero();
     }
    
    
c: X509_VERIFY_PARAM_inherit
 
     public int inherit(VerifyParameter src) { 
         long inh_flags;
         boolean to_dto_o;
 
         if(src == null) {
             return 1;
         }
 
 
        inh_flags = src.inheritFlags | this.;
        if((inh_flags & .) != 0) {
            this. = 0;
        }
        if((inh_flags & .) != 0) {
            return 1;
        }
        to_d = ((inh_flags & .) != 0);
        to_o = ((inh_flags & .) != 0);
        if(to_o || ((src.purpose != 0 && (to_d || this. == 0)))) {
            this. = src.purpose;
        }
        if(to_o || ((src.trust != 0 && (to_d || this. == 0)))) {
            this. = src.trust;
        }
        if(to_o || ((src.depth != -1 && (to_d || this. == -1)))) {
            this. = src.depth;
        }
        if(to_o || !((this. & .) != 0)) {
            this. = src.checkTime;
            this. &= ~.;
        }
        if((inh_flags & .) != 0) {
            this. = 0;
        }
        this. |= src.flags;
        if(to_o || ((src.policies != null && (to_d || this. == null)))) {
            setPolicies(src.policies);
        }
        return 1;
    }
    
    
c: X509_VERIFY_PARAM_set1
    public int set(VerifyParameter from) { 
        return inherit(from);
    } 
    
    
c: X509_VERIFY_PARAM_set1_name
    public int setName(String name) { 
        this. = name;
        return 1;
    }
    
    
c: X509_VERIFY_PARAM_set_flags
    public int setFlags(long flags) { 
        this. |= flags;
        if((flags & .) == .) {
            this. |= .;
        }
        return 1;
    } 
    
    
c: X509_VERIFY_PARAM_clear_flags
    public int clearFlags(long flags) { 
        this. &= ~flags;
        return 1;
    } 
    
    
c: X509_VERIFY_PARAM_get_flags
    public long getFlags() { 
        return ;
    } 
    
    
c: X509_VERIFY_PARAM_set_purpose
    public int setPurpose(int purpose) { 
        int[] arg = new int[]{this.};
        int v = Purpose.set(arg,purpose);
        this. = arg[0];
        return v;
    } 
    
    
c: X509_VERIFY_PARAM_set_trust
    public int setTrust(int trust) { 
        int[] arg = new int[]{this.};
        int v = Trust.set(arg,trust);
        this. = arg[0];
        return v;
    }
    
    
c: X509_VERIFY_PARAM_set_depth
    public void setDepth(int depth) {
        this. = depth;
    }
    
    
c: X509_VERIFY_PARAM_set_time
    public void setTime(Date t) {
        this. = t;
        this. |= .;
    } 
    
    
c: X509_VERIFY_PARAM_add0_policy
    public int addPolicy(DERObject policy) { 
        if( == null) {
             = new ArrayList<DERObject>();
        }
        .add(policy);
        return 1;
    }
    
    
c: X509_VERIFY_PARAM_set1_policies
    public int setPolicies(List<DERObject> policies) { 
        if(policies == null) {
            this. = null;
            return 1;
        }
        this. = new ArrayList<DERObject>();
        this..addAll(policies);
        this. |= .;
        return 1;
    }
    
    
c: X509_VERIFY_PARAM_get_depth
    public int getDepth() { 
        return ;
    }
    
    
c: X509_VERIFY_PARAM_add0_table
    public int addTable() { 
        for(Iterator<VerifyParameteriter = .iterator();iter.hasNext();) {
            VerifyParameter v = iter.next();
            if(this..equals(v.name)) {
                iter.remove();
            }
        }
        .add(this);
        return 1;
    } 
    public static VerifyParameter lookup(String name) { 
        for(VerifyParameter v : ) {
            if(name.equals(v.name)) {
                return v;
            }
        }
        for(VerifyParameter v : ) {
            if(name.equals(v.name)) {
                return v;
            }
        }
        return null
    }
    
    
c: X509_VERIFY_PARAM_table_cleanup
    public static void tableCleanup() {
        .clear();
    } 
    private final static VerifyParameter[] defaultTable = new VerifyParameter[] {
        new VerifyParameter(
                            "default",	/* X509 default parameters */
                            0,		/* Check time */
                            0,		/* internal flags */
                            0,		/* flags */
                            0,		/* purpose */
                            0,		/* trust */
                            100,	/* depth */
                            null	/* policies */
                            ),
        new VerifyParameter(
                            "pkcs7",			/* SSL/TLS client parameters */
                            0,				/* Check time */
                            0,				/* internal flags */
                            0,				/* flags */
                            .,	/* purpose */
                            .,		/* trust */
                            -1,				/* depth */
                            null				/* policies */
                            ),
        new VerifyParameter(
                            "ssl_client",			/* SSL/TLS client parameters */
                            0,				/* Check time */
                            0,				/* internal flags */
                            0,				/* flags */
                            .,	/* purpose */
                            .,		/* trust */
                            -1,				/* depth */
                            null				/* policies */
                            ),
        new VerifyParameter(
                            "ssl_server",			/* SSL/TLS server parameters */
                            0,				/* Check time */
                            0,				/* internal flags */
                            0,				/* flags */
                            .,	/* purpose */
                            .,		/* trust */
                            -1,				/* depth */
                            null				/* policies */
                            )};
    private final static List<VerifyParameterparameterTable = new ArrayList<VerifyParameter>();
}// X509_VERIFY_PARAM
New to GrepCode? Check out our FAQ X