title: Android Sdk: BASE64 Encoder/Decoder not importing
body: <p>So I am trying to implement a string encryption class that I got from <a href="http://www.digizol.com/2009/10/java-encrypt-decrypt-jce-salt.html" rel="nofollow">link to code</a></p>
  
  <p>and when I try to put it into my android project, I receive the following errors:</p>
  
  <blockquote>
    <p>Description   Resource    Path    Location    Type The import sun cannot be
    resolved  SimpleProtector.java    /EncryptedSMS/src/com/nsaers/encryptedsms   line
    7 Java Problem BASE64Decoder cannot be resolved to a
    type  SimpleProtector.java    /EncryptedSMS/src/com/nsaers/encryptedsms   line
    29    Java Problem BASE64Encoder cannot be resolved to a
    type  SimpleProtector.java    /EncryptedSMS/src/com/nsaers/encryptedsms   line
    21    Java Problem</p>
  </blockquote>
  
  <p>Any ideas?</p>
  
  <p>Here is my code of the class:</p>
  
  <pre><code>package com.nsaers.encryptedsms;
  
  import java.security.Key;
  
  import javax.crypto.Cipher;
  import javax.crypto.spec.SecretKeySpec;
  
  public class SimpleProtector {
      private static final String ALGORITHM = "AES";
      private static final byte[] keyValue = new byte[] { 'T', 'h', 'i', 's',
              'I', 's', 'A', 'S', 'e', 'c', 'r', 'e', 't', 'K', 'e', 'y' };
  
      public static String encrypt(String valueToEnc) throws Exception {
          Key key = generateKey();
          Cipher c = Cipher.getInstance(ALGORITHM);
          c.init(Cipher.ENCRYPT_MODE, key);
          byte[] encValue = c.doFinal(valueToEnc.getBytes());
          String encryptedValue = new BASE64Encoder().encode(encValue);
          return encryptedValue;
      }
  
      public static String decrypt(String encryptedValue) throws Exception {
          Key key = generateKey();
          Cipher c = Cipher.getInstance(ALGORITHM);
          c.init(Cipher.DECRYPT_MODE, key);
          byte[] decordedValue = new BASE64Decoder().decodeBuffer(encryptedValue);
          byte[] decValue = c.doFinal(decordedValue);
          String decryptedValue = new String(decValue);
          return decryptedValue;
      }
  
      private static Key generateKey() throws Exception {
          Key key = new SecretKeySpec(keyValue, ALGORITHM);
          // SecretKeyFactory keyFactory =
          // SecretKeyFactory.getInstance(ALGORITHM);
          // key = keyFactory.generateSecret(new DESKeySpec(keyValue));
          return key;
      }
  }
  </code></pre>