Android Open Source - SmartPass Simple Crypto






From Project

Back to project page SmartPass.

License

The source code is released under:

Copyright (c) 2013 Dax Earl, Aaron Golliver Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal ...

If you think the Android project SmartPass listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.passwordLib;
/*from w ww .  j  av  a2  s . c  om*/
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

import javax.crypto.*;
import javax.crypto.spec.*;

public class SimpleCrypto {
  private static final String ALGORITHME = "Blowfish";
  private static final String TRANSFORMATION = "Blowfish/ECB/PKCS5Padding";
  private static final String CHARSET = "ISO-8859-1";

  public static String encrypt(String plaintext, String SECRET)
      throws NoSuchAlgorithmException, NoSuchPaddingException,
      InvalidKeyException, UnsupportedEncodingException,
      IllegalBlockSizeException, BadPaddingException {

    Cipher cipher = Cipher.getInstance(TRANSFORMATION);
    cipher.init(Cipher.ENCRYPT_MODE,
        new SecretKeySpec(SECRET.getBytes(CHARSET), ALGORITHME));
    return new String(cipher.doFinal(plaintext.getBytes()), CHARSET);
  }

  public static String decrypt(String ciphertext, String SECRET)
      throws NoSuchAlgorithmException, NoSuchPaddingException,
      InvalidKeyException, UnsupportedEncodingException,
      IllegalBlockSizeException, BadPaddingException {
    Cipher cipher = Cipher.getInstance(TRANSFORMATION);
    cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(SECRET.getBytes(),
        ALGORITHME));
    return new String(cipher.doFinal(ciphertext.getBytes(CHARSET)), CHARSET);
  }
}




Java Source Code List

com.example.smartpass.ClearClipboard.java
com.example.smartpass.CopyPasswordToClipboard.java
com.example.smartpass.CopyUsernameToClipboard.java
com.example.smartpass.DeletePassword.java
com.example.smartpass.LoginScreen.java
com.example.smartpass.NewAccount.java
com.example.smartpass.NewFolder.java
com.example.smartpass.PasswordList.java
com.example.smartpass.UserAccount.java
com.example.smartpass.Adapter.NothingSelectedSpinnerAdapter.java
com.example.smartpass.Adapter.PasswordListAdapter.java
com.example.smartpass.Classes.ExpandListChild.java
com.example.smartpass.Classes.ExpandListGroup.java
com.passwordLib.Main.java
com.passwordLib.PasswordFile.java
com.passwordLib.PasswordLib.java
com.passwordLib.RetrivePasswordTask.java
com.passwordLib.SendPasswordTask.java
com.passwordLib.SimpleCrypto.java