Examples of SwedishEIDProfile


Examples of org.ejbca.core.model.hardtoken.profiles.SwedishEIDProfile

        decoder.close();
        // Handle Base64 encoded string values
        HashMap data = new Base64GetHashMap(h);
        switch (((Integer) (data.get(HardTokenProfile.TYPE))).intValue()) {
        case SwedishEIDProfile.TYPE_SWEDISHEID:
            profile = new SwedishEIDProfile();
            break;
        case EnhancedEIDProfile.TYPE_ENHANCEDEID:
            profile = new EnhancedEIDProfile();
            break;
        case TurkishEIDProfile.TYPE_TURKISHEID:
View Full Code Here

Examples of org.ejbca.core.model.hardtoken.profiles.SwedishEIDProfile

     * Creates the 'Administrator Token' Hard Token Profile
     *
     * @throws Exception
     */
    private void createAdministratorTokenProfile() throws Exception {
        SwedishEIDProfile admintokenprofile = new SwedishEIDProfile();

        admintokenprofile.setPINEnvelopeType(IPINEnvelopeSettings.PINENVELOPETYPE_GENERALENVELOBE);

        BufferedReader br = new BufferedReader(new FileReader(SVGPINFILENAME));
        String filecontent = "";
        String nextline = "";
        while (nextline != null) {
View Full Code Here

Examples of org.ejbca.core.model.hardtoken.profiles.SwedishEIDProfile

     * @throws Exception
     *             error
     */
    public void test01AddHardTokenProfile() throws HardTokenProfileExistsException {

        SwedishEIDProfile profile = new SwedishEIDProfile();
        EnhancedEIDProfile profile2 = new EnhancedEIDProfile();
        TurkishEIDProfile turprofile = new TurkishEIDProfile();

        String svgdata = createSVGData();
        profile.setPINEnvelopeData(svgdata);
        profile2.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC, true);

        hardTokenSession.addHardTokenProfile(admin, "SWETEST", profile);
        hardTokenSession.addHardTokenProfile(admin, "ENHTEST", profile2);
        hardTokenSession.addHardTokenProfile(admin, "TURTEST", turprofile);

        SwedishEIDProfile profile3 = (SwedishEIDProfile) hardTokenSession.getHardTokenProfile(admin, "SWETEST");
        EnhancedEIDProfile profile4 = (EnhancedEIDProfile) hardTokenSession.getHardTokenProfile(admin, "ENHTEST");
        TurkishEIDProfile turprofile2 = (TurkishEIDProfile) hardTokenSession.getHardTokenProfile(admin, "TURTEST");

        String svgdata2 = profile3.getPINEnvelopeData();

        assertTrue("Saving SVG Data failed", svgdata.equals(svgdata2));
        assertTrue("Saving Hard Token Profile failed", profile4.getIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC));
        assertTrue("Saving Turkish Hard Token Profile failed", (turprofile2 != null));
    }
View Full Code Here

Examples of org.ejbca.core.model.hardtoken.profiles.SwedishEIDProfile

       // Add profile and display profilespage.
       profile = request.getParameter(TEXTFIELD_HARDTOKENPROFILESNAME);
       if(profile != null){
         if(!profile.trim().equals("")){         
         try{
           if(!handler.addHardTokenProfile(profile.trim(), new SwedishEIDProfile())){
            profilemalformed = true
           }
         }catch( HardTokenProfileExistsException e){
           hardtokenprofileexists=true;
         }            
         }     
       }
       includefile=PAGE_HARDTOKENPROFILES;
      }
      if( request.getParameter(BUTTON_CLONE_HARDTOKENPROFILES) != null){
       // clone profile and display profilespage.
       String newhardtokenprofilename = request.getParameter(TEXTFIELD_HARDTOKENPROFILESNAME);
       String oldhardtokenprofilename = request.getParameter(SELECT_HARDTOKENPROFILES);
       if(oldhardtokenprofilename != null && newhardtokenprofilename != null){
       if(!newhardtokenprofilename.trim().equals("") && !oldhardtokenprofilename.trim().equals("")){           
         try{
         handler.cloneHardTokenProfile(oldhardtokenprofilename.trim(),newhardtokenprofilename.trim());
         }catch(HardTokenProfileExistsException e){
           hardtokenprofileexists=true;
         }
       }
       }     
        includefile=PAGE_HARDTOKENPROFILES;
      }
    }
   
    if( action.equals(ACTION_EDIT_HARDTOKENPROFILE)){
       // Display edit access rules page.
       profile = request.getParameter(HIDDEN_HARDTOKENPROFILENAME);
       if(profile != null){
       if(!profile.trim().equals("")){
         if(request.getParameter(BUTTON_SAVE) != null ||
            request.getParameter(BUTTON_UPLOADENVELOPETEMP) != null ||
          request.getParameter(BUTTON_UPLOADVISUALTEMP) != null ||
          request.getParameter(BUTTON_UPLOADRECEIPTTEMP) != null ||
          request.getParameter(BUTTON_UPLOADADRESSLABELTEMP) != null ){
   
            
         if(profiledata == null){              
           String tokentype = request.getParameter(HIDDEN_HARDTOKENTYPE);
           if(tokentype.equals(TYPE_SWEDISHEID)) {
           profiledata = new SwedishEIDProfile();
           }
           if(tokentype.equals(TYPE_ENCHANCEDEID)) {
           profiledata = new EnhancedEIDProfile();
           }
           if(tokentype.equals(TYPE_TURKISHEID)) {
           profiledata = new TurkishEIDProfile();
           }
         }
         // Save changes.
                   
         // General settings  
         String value = request.getParameter(TEXTFIELD_SNPREFIX);
         if(value != null){                             
           value = value.trim();
           profiledata.setHardTokenSNPrefix(value);
         }
         value = request.getParameter(CHECKBOX_EREASBLE);
         if(value != null){                             
           profiledata.setEreasableToken(value.equals(CHECKBOX_VALUE));
         }else {
           profiledata.setEreasableToken(false);
         }
         value = request.getParameter(SELECT_NUMOFTOKENCOPIES);
         if(value != null){                                        
           profiledata.setNumberOfCopies(Integer.parseInt(value));
         }

        value = request.getParameter(CHECKBOX_USEIDENTICALPINS);
        if(value != null){                             
          profiledata.setGenerateIdenticalPINForCopies(value.equals(CHECKBOX_VALUE));
        }else {
          profiledata.setGenerateIdenticalPINForCopies(false);
        }
        if(profiledata instanceof HardTokenProfileWithPINEnvelope){
          value = request.getParameter(SELECT_ENVELOPETYPE);
          if(value != null) {                                              
            ((HardTokenProfileWithPINEnvelope) profiledata).setPINEnvelopeType(Integer.parseInt(value));
          }
          value = request.getParameter(SELECT_NUMOFENVELOPECOPIES);
          if(value != null) {                                              
            ((HardTokenProfileWithPINEnvelope) profiledata).setNumberOfPINEnvelopeCopies(Integer.parseInt(value));
          }
          value = request.getParameter(TEXTFIELD_VISUALVALIDITY);
          if(value != null) {                                       
            ((HardTokenProfileWithPINEnvelope) profiledata).setVisualValidity(Integer.parseInt(value));                                
          }
        }
 
         if(profiledata instanceof HardTokenProfileWithVisualLayout){
           HardTokenProfileWithVisualLayout visprof = (HardTokenProfileWithVisualLayout) profiledata;
           value = request.getParameter(SELECT_VISUALLAYOUTTYPE);
           if(value != null) {                                       
             visprof.setVisualLayoutType(Integer.parseInt(value));
           }
         }
        
         if(profiledata instanceof HardTokenProfileWithReceipt){
             value = request.getParameter(SELECT_RECEIPTTYPE);
             if(value != null) {                                              
             ((HardTokenProfileWithReceipt) profiledata).setReceiptType(Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_NUMOFRECEIPTCOPIES);
             if(value != null) {                                              
            ((HardTokenProfileWithReceipt) profiledata).setNumberOfReceiptCopies(Integer.parseInt(value));
             }
         }
         if(profiledata instanceof HardTokenProfileWithAdressLabel){
             value = request.getParameter(SELECT_ADRESSLABELTYPE);
             if(value != null) {                                              
             ((HardTokenProfileWithAdressLabel) profiledata).setAdressLabelType(Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_NUMOFADRESSLABELCOPIES);
             if(value != null) {                                              
            ((HardTokenProfileWithAdressLabel) profiledata).setNumberOfAdressLabelCopies(Integer.parseInt(value));
             }
         }

         if(profiledata instanceof SwedishEIDProfile){
                   SwedishEIDProfile sweprof = (SwedishEIDProfile) profiledata;
                  
           value = request.getParameter(SELECT_MINKEYLENGTH);
           if(value!= null){
           int val = Integer.parseInt(value);          
           sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_SIGN, val);
           sweprof.setMinimumKeyLength(SwedishEIDProfile.CERTUSAGE_AUTHENC, val);
           sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA);
           sweprof.setKeyType(SwedishEIDProfile.CERTUSAGE_AUTHENC, EIDProfile.KEYTYPE_RSA);
           }
           value = request.getParameter(CHECKBOX_CERTWRITABLE);
           if(value != null){                             
             sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE));
             sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_AUTHENC, value.equals(CHECKBOX_VALUE));
           }else{
             sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_SIGN, false);
             sweprof.setCertWritable(SwedishEIDProfile.CERTUSAGE_AUTHENC, false);
           }
              
                   value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0");
                   if(value!= null) {
                     sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
                   }
           value = request.getParameter(SELECT_CA + "0");
           if(value!= null) {
             sweprof.setCAId(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_PINTYPE + "0");
           if(value!= null) {
             sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_MINPINLENGTH + "0");
           if(value!= null) {
             sweprof.setMinimumPINLength(SwedishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1");
           if(value!= null) {
             sweprof.setCertificateProfileId(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_CA + "1");
           if(value!= null) {
             sweprof.setCAId(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_PINTYPE + "1");
           if(value!= null) {
             sweprof.setPINType(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_MINPINLENGTH + "1");
           if(value!= null) {
           sweprof.setMinimumPINLength(SwedishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));                 
           }
         }

         if(profiledata instanceof TurkishEIDProfile){
             TurkishEIDProfile turkprof = (TurkishEIDProfile) profiledata;
                    
             value = request.getParameter(SELECT_MINKEYLENGTH);
             if(value!= null){
             int val = Integer.parseInt(value);          
             turkprof.setMinimumKeyLength(TurkishEIDProfile.CERTUSAGE_SIGN, val);
             turkprof.setMinimumKeyLength(TurkishEIDProfile.CERTUSAGE_AUTHENC, val);
             turkprof.setKeyType(TurkishEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA);
             turkprof.setKeyType(TurkishEIDProfile.CERTUSAGE_AUTHENC, EIDProfile.KEYTYPE_RSA);
             }
             value = request.getParameter(CHECKBOX_CERTWRITABLE);
             if(value != null){                             
               turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE));
               turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_AUTHENC, value.equals(CHECKBOX_VALUE));
             }else{
               turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_SIGN, false);
               turkprof.setCertWritable(TurkishEIDProfile.CERTUSAGE_AUTHENC, false);
             }
                
                     value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0");
                     if(value!= null) {
                       turkprof.setCertificateProfileId(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
                     }
             value = request.getParameter(SELECT_CA + "0");
             if(value!= null) {
               turkprof.setCAId(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_PINTYPE + "0");
             if(value!= null) {
               turkprof.setPINType(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_MINPINLENGTH + "0");
             if(value!= null) {
               turkprof.setMinimumPINLength(TurkishEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1");
             if(value!= null) {
               turkprof.setCertificateProfileId(TurkishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));
             }
             value = request.getParameter(SELECT_CA + "1");
             if(value!= null) {
               turkprof.setCAId(TurkishEIDProfile.CERTUSAGE_AUTHENC, Integer.parseInt(value));
             }
           }        
        
         if(profiledata instanceof EnhancedEIDProfile){
           EnhancedEIDProfile enhprof = (EnhancedEIDProfile) profiledata;

           value = request.getParameter(SELECT_MINKEYLENGTH);
           if(value!= null){          
              int val = Integer.parseInt(value);
           enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_SIGN, val);
           enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_AUTH, val);
           enhprof.setMinimumKeyLength(EnhancedEIDProfile.CERTUSAGE_ENC, val);
           enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_SIGN, EIDProfile.KEYTYPE_RSA);
           enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, EIDProfile.KEYTYPE_RSA);
           enhprof.setKeyType(EnhancedEIDProfile.CERTUSAGE_ENC, EIDProfile.KEYTYPE_RSA);
           }   
          
           value = request.getParameter(CHECKBOX_CERTWRITABLE);
           if(value != null){                             
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_SIGN, value.equals(CHECKBOX_VALUE));
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_AUTH, value.equals(CHECKBOX_VALUE));
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_ENC, value.equals(CHECKBOX_VALUE));
           }else{
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_SIGN, false);
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_AUTH, false);
             enhprof.setCertWritable(EnhancedEIDProfile.CERTUSAGE_ENC, false);
           }
          
           value = request.getParameter(SELECT_CERTIFICATEPROFILE + "0");
           if(value!= null) {
           enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_CA + "0");
           if(value!= null) {
           enhprof.setCAId(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_PINTYPE + "0");
           if(value!= null) {
           enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_MINPINLENGTH + "0");
           if(value!= null) {
              enhprof.setMinimumPINLength(EnhancedEIDProfile.CERTUSAGE_SIGN, Integer.parseInt(value));
           }
                   enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_SIGN, false);
                   
           value = request.getParameter(SELECT_CERTIFICATEPROFILE + "1");
           if(value!= null) {
           enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_CA + "1");
           if(value!= null) {
           enhprof.setCAId(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_PINTYPE + "1");
           if(value!= null) {
           enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_MINPINLENGTH + "1");
           if(value!= null) {
              enhprof.setMinimumPINLength(EnhancedEIDProfile.CERTUSAGE_AUTH, Integer.parseInt(value));
           }
           enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_AUTH, false);

           value = request.getParameter(SELECT_CERTIFICATEPROFILE + "2");
           if(value!= null) {
           enhprof.setCertificateProfileId(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_CA + "2");
           if(value!= null) {
           enhprof.setCAId(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_PINTYPE + "2");
           if(value!= null) {
           enhprof.setPINType(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));
           }
           value = request.getParameter(SELECT_MINPINLENGTH + "2");
           if(value!= null) {
              enhprof.setMinimumPINLength(EnhancedEIDProfile.CERTUSAGE_ENC, Integer.parseInt(value));
           }
           value = request.getParameter(CHECKBOX_KEYRECOVERABLE + "2");
          if(value != null) {                             
            enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC, value.equals(CHECKBOX_VALUE));
          } else {
            enhprof.setIsKeyRecoverable(EnhancedEIDProfile.CERTUSAGE_ENC, false);
          }
          value = request.getParameter(CHECKBOX_REUSEOLDCERT + "2");
          if(value != null) {                             
            enhprof.setReuseOldCertificate(EnhancedEIDProfile.CERTUSAGE_ENC, value.equals(CHECKBOX_VALUE));
          } else {
            enhprof.setReuseOldCertificate(EnhancedEIDProfile.CERTUSAGE_ENC, false);
         
         
         }

                              
         if(request.getParameter(BUTTON_SAVE) != null){
           if(!handler.changeHardTokenProfile(profile,profiledata)){
             profilemalformed = true;         
           }
           includefile=PAGE_HARDTOKENPROFILES;
         }        
         if(request.getParameter(BUTTON_UPLOADENVELOPETEMP) != null){
           uploadmode = UPLOADMODE_ENVELOPE;
           includefile=PAGE_UPLOADTEMPLATE;
         }
         if(request.getParameter(BUTTON_UPLOADVISUALTEMP) != null){
           uploadmode =  UPLOADMODE_VISUAL;
           includefile=PAGE_UPLOADTEMPLATE;
         }   
         if(request.getParameter(BUTTON_UPLOADRECEIPTTEMP) != null){
            uploadmode = UPLOADMODE_RECEIPT;
          includefile=PAGE_UPLOADTEMPLATE;
         }
         if(request.getParameter(BUTTON_UPLOADADRESSLABELTEMP) != null){
          uploadmode = UPLOADMODE_ADRESSLABEL;
          includefile=PAGE_UPLOADTEMPLATE;
        }            
        
         }
         if(request.getParameter(BUTTON_CANCEL) != null){
          // Don't save changes.
         includefile=PAGE_HARDTOKENPROFILES;
         }

       }
      }
    }
   
    if( action.equals(ACTION_CHANGE_PROFILETYPE)){
      this.profilename = request.getParameter(HIDDEN_HARDTOKENPROFILENAME);
      String value = request.getParameter(SELECT_HARDTOKENTYPE);
      if(value!=null){       
      int profiletype = Integer.parseInt(value);
      EIDProfile newprofile = null;
      switch(profiletype){         
        case SwedishEIDProfile.TYPE_SWEDISHEID :
          newprofile = new SwedishEIDProfile();
        break;
        case EnhancedEIDProfile.TYPE_ENHANCEDEID:
          newprofile =  new EnhancedEIDProfile();             
        break;   
        case TurkishEIDProfile.TYPE_TURKISHEID:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.