1 4 5 package com.ca.directory.jxplorer.editor; 6 7 import com.ca.commons.security.cert.*; 8 import com.ca.commons.security.cert.CertViewer; 9 import com.ca.commons.cbutil.*; 10 11 import java.awt.Frame ; 12 import java.security.cert.X509Certificate ; 13 import java.util.Arrays ; 14 15 19 20 public class usercertificateeditor implements abstractbinaryeditor 21 { 22 Frame owner; 23 24 public usercertificateeditor(Frame owner) 25 { 26 this.owner = owner; 27 } 28 29 33 34 public void setValue(editablebinary editMe) 35 { 36 byte[] data = editMe.getValue(); 37 38 CertViewer.CertAndFileName returnVal = null; 39 40 try 41 { 42 returnVal = CertViewer.editCertificate(owner, data); 43 } 44 catch (Exception e) 45 { 46 CBUtility.error(CBIntText.get("Error reading certificate."), e); 47 } 48 49 X509Certificate cert = null; 50 51 if(returnVal != null) cert = returnVal.cert; 53 54 if (cert != null) 55 { 56 try 57 { 58 byte[] newData = cert.getEncoded(); 59 if (Arrays.equals(newData, data) == false) 60 editMe.setValue(newData); 61 } 62 catch(Exception e) 63 { 64 CBUtility.error(CBIntText.get("Error: unable to modify certificate."), e); 65 } 66 } 67 } 68 } | Popular Tags |