package com.nortelnetworks.is.sec ; import java.awt.*; import java.awt.event.*; import java.io.* ; import java.util.*; import com.ms.wfc.app.Registry; import com.ms.wfc.app.RegistryKey; /* Java 1.1+ Applet IE email Attachment Security Customizer. Enables/disables Outlook2000 SR-1 file-attachment security 05/23/2000 M. Gallant */ public class SecureAttach extends java.applet.Applet implements ActionListener, MouseListener { private static final String SecFilepath = "Software\\Microsoft\\Office\\9.0\\Outlook\\Security"; private static String secfiles = "ade;adp;bas;bat;chm;cmd;com;cpl;crt;exe;hlp;hta;inf;ins;isp;js;jse;lnk;mdb;mde;msc;msi;msp;mst;pcd;pif;reg;scr;sct;shs;url;vb;vbe;vbs;wsc;wsf;wsh" ; private static String nosecfiles = "" ; private Button b1, b2, bexit ; Label l1, lslide; String[] headerfields = {" Outlook2000 Customizer ", "Version 1.0" , " by M. Gallant 05/23/2000" } ; int headers = headerfields.length ; int headerindex = 0; public void init() { this.setLayout(new BorderLayout()) ; if(System.getProperty("os.name").indexOf("NT")>=0) //for NT platform ; // add other tests for other platform scripts Panel p = new Panel() ; p.setLayout(new GridLayout(1,2,10,10)) ; l1= new Label(headerfields[0],Label.CENTER) ; l1.setFont(new Font("TimesRoman", Font.BOLD, 15)) ; l1.addMouseListener(this) ; l1.setForeground(Color.yellow) ; l1.setBackground(Color.blue) ; lslide = new Label(" --- Outlook2000 SR-1 Attachment Customizer --- ",Label.CENTER) ; b1=new Button("Secure Attachments") ; b1.addActionListener(this) ; b2=new Button("Unsecure Attachments") ; b2.addActionListener(this) ; bexit=new Button("--- EXIT ---") ; bexit.setBackground(Color.red); bexit.addActionListener(this) ; p.add(b1); p.add(b2); p.validate(); Panel p2=new Panel() ; p2.add(p) ; add("Center", p2); p=new Panel(); p.setBackground(Color.blue) ; p.add(l1) ; p.addMouseListener(this) ; add("North",p) ; p2 = new Panel() ; p2.add(lslide) ; add("South",p2) ; } public Insets getInsets() { return new Insets(5,5,5,5) ; } public void paint(Graphics g) { g.setColor(Color.black) ; g.drawRect(0,0,this.getSize().width-1, this.getSize().height-1) ; } public void mousePressed(MouseEvent e) { headerindex = ++headerindex % headers ; if(headerindex==0) l1.setFont(new Font("TimesRoman", Font.BOLD, 16)) ; else l1.setFont(new Font("TimesRoman", Font.PLAIN, 12)) ; l1.setText(headerfields[headerindex]) ; } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public void actionPerformed(ActionEvent e) { if ((e.getActionCommand()).equals("Secure Attachments")){ if(setSecurity(secfiles)) lslide.setText(" ** Security SET for Attachments ** ") ; else lslide.setText(" ** Problem accessing registry ** ") ; } else if ((e.getActionCommand()).equals("Unsecure Attachments")){ if(setSecurity(nosecfiles)) lslide.setText(" NO security for attachments ") ; else lslide.setText(" ** Problem accessing registry ** ") ; } else if ((e.getActionCommand()).equals("--- EXIT ---")) System.exit(0) ; } private boolean setSecurity(String filetypes) { RegistryKey zonekey = Registry.LOCAL_MACHINE.createSubKey(SecFilepath) ; // create or open if(zonekey==null) return false; else zonekey.setValue("AddWarningFileTypes", filetypes) ; // changed security values return true; } }