Trying to encrypt a sentence

I'm doing a project where I am supposed to implement the Vigenere cipher.
I am supposed to read in a file that has the sentence/text to be encrypted, and then have the person enter a keyword to shift the letters with...but what's confusing me is trying to get the nested loops right to read through the plaintext and the keyword and then adding them together, so here the String plain is going to be the plaintext.
public static void encrypt(String plain, String keyWord)
for(int i=0; i<=plain.length(); i++)
char c = plain.charAt(i);
int z = (int) c;
     while(i<=plain.length()) //while it's looping through the plaintext i want it to loop through keyWord
          for(int j=0; j<=keyWord.length(); j++)
          char k = keyWord.charAt(j);
          int y = (int) k;
          int alg = (y + z) % 26;
     //need to convert back to letters
Part of the problem is that I can't figure out how to make it loop through the characters of the keyword over and over...I assumed I needed to use a while loop but like here I've got for(int j=0; j<=keyword.length; j++) nested in a while loop. With what I have here it only loops through it once.
So can someone please point me in the right direction or tell me if I should be doing this a completely different way(and, if I need to use an array or something please tell me because we haven't learned those yet, but something silly like us not having yet learned something has not stopped my professor from requiring us to use it)
When I just test what I've got here I also get an error about my string index being out of bounds, and I've searched and searched and cannot figure out what I've done here to get that error.

Sorry about the above I never saw that it was the Vigenre cipher
public static void encrypt(String plain, String keyWord){
  for(int i=0; i<=plain.length(); i++){
    char c = plain.charAt(i);
    int z = (int) c;
    while(i<=plain.length()) //while it's looping through the plaintext i want it to loop through keyWord{
      for(int j=0; j<=keyWord.length(); j++){
        char k = keyWord.charAt(j);
        int y = (int) k;
        int alg = (y + z) % 26;
        //need to convert back to letters
}A few things you will need to remember:
Because in java A starts at 65 and a at 97 you can only work in either uppercase or lowercase letters without mixing.
To display the text you need to know if it was originally upper or lowercase.
Only characters from a-z or A-Z can be used.I don't like to simply give code but here is a method that only uses 1 loop:
//remove all chars that are not a-zA-Z and make all chars uppercase in bot value and key before mkKet or encrypt is called
//used to make the key the same length as the value
  public String mkKey(String plain, String key){
    if(plain.length() == key.length())
      return key;
    if(plain.length() < key.length())
      return key.substring(0,plain.length());
    String out = "";
    for(int i=0;i<plain.length();i++){
      out += key.charAt(i%key.length());
    return out;
  public String encrypt(String value, String key){
    int v;
    int k;
    String out = "";
    for(int i=0;i<value.length();i++){
      v = value.charAt(i);
      k = key.charAt(i);
      out += (char)(((v + k) % 26) + 65);
    return out;
The Vigenre cipher rule says:
C ~i~ = (P ~i~ + K ~i~ ) MOD 26
P ~i~ = (C ~i~ - K ~i~ ) MOD 26but when C ~i~ - K ~i~ returns a negitive it must change to:
P ~i~ = (26 + (C ~i~ - K ~i~ )) MOD 26

Similar Messages

  • Error message when trying to encrypt a WD drive of 3 To

    When I have tried to encrypt a Western Digital My Book Essential external drive of 3 To on my iMac, OS X Mountain Lion give me this error message:
    «MediaKit signale une erreur de taille de bloc, généralement causée pour ne pas être un multiple de 512»
    But I did not have any problem encrypting a similar external drive Western Digital My Book Essential 2 To.
    Is it a problem of Mountain Lion or Western Digital?
    Do you have a solution?

    Thank you.
    In fact the new version 10.8.2 of OS X Mountain Lion  solved the problem.
    Now my Western Digital My Book Essential external drive of 3 To can be encrypt. 

  • Trying to encrypt RTP audio stream

    I'm trying to encrypt audio (after compression) on the transmitter side and decrypt it on the receiving side.
    I tried making a wrapper around the PushBufferDataSource at both ends (provided by the processor and the RTPManager), which also wraps PushBufferStream. This sort-of works, I can use a java.nio.ByteBuffer to flip the bytes around in the javax.media.Buffer i'm reading from, and I can do a simple character swapping cipher. But, when it fails when I try to use AES, either because blocks aren't 16 bytes long, or once, I fixed that, the player trys reading too far ahead.
    Second, I've tried the custom packetizer and depacketizer provided on the JMF solutions page. It does play, and I assume I need to put my encryption code in the process() method. But, that method never seems to be called.
    I know the constructor is called, but process() never is, thus my encryption code is never run.
    Can someone help with any of these problems???
    (PS: Please send example code b/c its easier for me to understand)

    I have just managed to solve this problem.
    Thanks

  • I tried to encrypt using file vault but it froze slowing my macbook pro, how can i get things moving or stop the encryption

    i tried to encrypt using file vault but it froze slowing my macbook pro, how can i get things moving or stop the encryption

    Back up all data before proceeding. There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    Start up in Recovery mode. When the OS X Utilities screen appears, select Disk Utility.
    In the Disk Utility window, select the icon of the startup volume from the list on the left. It will be nested below another disk icon, usually with the same name. Click the Unlock button in the toolbar. When prompted, enter the login password of a user authorized to unlock the volume, or the alternate decryption key that was generated when you activated FileVault.
    Then, from the menu bar, select
              File ▹ Turn Off Encryption
    Enter the password again.
    You can then restart as usual, if the system is working. Decryption will be completed in the background. It may take several hours, and during that time performance will be reduced.
    If you can't turn off encryption in Disk Utility because the menu item is grayed out, you'll have to erase the volume and then restore the data from a backup. Select the Erase tab, and then select
              Mac OS Extended (Journaled)
    from the Format menu.
    You can then quit to be returned to the main Recovery screen. Follow these instructions if you back up with Time Machine. If you use other backup software, follow its developer's instructions.
    Don't erase the volume unless you have at least two complete, independent backups. One is not enough to be safe.

  • I have a 32GB thumb dr and I wanted to encrypt it. I used disk utility, Partition, apply. Then went back and tried to encrypt it and it still ask that GUID be setup  on it. What must I do now, or how is the better question?

    I have a 32GB thumb dr and I wanted to encrypt it. I used disk utility, Partition, apply. Then went back and tried to encrypt it and it still ask that GUID be setup  on it. What must I do now, or how is the better question?

    I have a 32GB thumb dr and I wanted to encrypt it. I used disk utility, Partition, apply. Then went back and tried to encrypt it and it still ask that GUID be setup  on it. What must I do now, or how is the better question?

  • Trying to Encrypt PDF

    When printing a document using the PDF button and the PDF services that are under that button. I am trying to Encrypt the PDF, save the file on a share point, rename the file, and make a new email of the encrypted PDF.
    My first attempt was successful with all except the encrypting of the PDF.
    After messing with the workflow and starting over several times I am no longer to get it to do even that. I'm told that it couldn't create the file when trying to copy it, but if I send it to the desktop it will create the file. I have permissions to this share point, and it saved in this location initially.
    The Workflow that I am have is as follows:
    1. Encrypt PDF
    2. Copy Finder Items
    3. Rename Finder Items
    4. New Mail Message
    I've tried moving the "Encrypt PDF" around to different locations with no luck.
    Currently I have removed step 4 in efforts to simplify troubleshooting.
    I have also inserted a "Get Specific Finder Items" in place number 1 and it would actually encrypt and prep the email as expected when run within Automator. That same workflow, saved with the "Get Specific Finder Items" removed, and run from the PDF services would not encrypt at all.
    If "Encrypt PDF" is placed on the end of the workflow (Number 4 removed) it will create the encrypted file in the /private/tmp/ directory, but then how do I get it out of that directory to replace the one that was already saved with the custom name, when that is the directory that I am getting out if in the first place?
    Does anyone have any Ideas, or even starting from the ground up with a new workflow structured differently?
    Thanks

    I am using the stock actions in Automator and saving the workflow at /Library/PDF Services/.
    The action is "Encrypt PDF" which in reality seems to be password protecting it, either way I need to have these files pass code protected, and have been doing it manually up to now.
    Normally when you "Save as a PDF" there is a "Security Options" button near the bottom when you are choosing your file name and location to save. It appears to be function of doing that automatically.
    I do not have the full Acrobat program.

  • Trying to encrypt a config file with aspnet.regiis.exe.

    Hello,
    I am trying to encrypt a file using aspnet.regiis.exe. The problem I am running into is the file is not the web.config file that aspnet wants to encrypt. It is a file named CustomerConnStrings.config. I have tried to encrypt it, but aspnet_regiis errors
    out saying that "The configuratino for physical path 'c:\temp\customerconnstrings.config' cannot be opened. Failed!"
    The command I am running is :
    aspnet_regiis.exe -pef "connectionStrings" "C:\Temp\CustomerConnStrings.config"
    I tried to run cmd as both Administrator and a regular user. I have tried to run the 64bit version of aspnet_regiis. I am able to rename the CustomerConnStrings.config file to web.config and add the <configuration> lines in and then it will allow me
    to encrypt it, but I am hoping that is not the best solution.
    Thanks!

    Hi Andy,
    Please post your thread on asp.net forum for effective response.
    http://forums.asp.net/.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • AES Algorithm error when trying to encrypt using stored Java class.

    Dear All,
    We have a specific reuirement where in we cannot use DBMS_CRYPTO package to encrypt/decrypt data using AES Algorithm
    So I am trying to use a stored Java class and I am getting "AES algorithm not available".
    I am using Oracle 10gR2 standard edition.
    Below is my code
    1. Stored Java class
    2. Stored function to access the above Java class.
    3. Test anonymus PL/SQL to test above code.
    Please help me finding the problem why I am getting "AES algorithm not available" error when I call stored Java class in Oracle.?
    **** If I use "DES" algorithm, it works. Also the Java code works well if I execute it as normal Java class from Eclipse.
    I verified the java.security file in jre/lib/security and I see that there is provider entry for SunJCE.
    The jre version in Oracle is 1.4.2.
    I appreciate your help.
    Thanks,
    Priyanka
    Step1: Stored java class to encrypt and decrypt data
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "EncryptUtil" AS
    import java.security.Key;
    import javax.crypto.Cipher;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.spec.SecretKeySpec;
    public class EncryptUtil
         public static String encrypt(String inStr)
         String outStr = "Test data 123";
    try
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    kgen.init(128);
    SecretKey skey = kgen.generateKey();
    byte[] raw = skey.getEncoded();
    SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
    byte[] encrypted =
    cipher.doFinal(inStr.getBytes());
    outStr =new String(encrypted);
    catch (Exception e)
         outStr = outStr + "exception thrown::" + e.getMessage();
    e.printStackTrace();
    return outStr;
    Step2: Stored function to access above stored java class.
    CREATE OR REPLACE FUNCTION SF_ENCRYPTUTIL(
    pKey1 VARCHAR2
    ) RETURN VARCHAR2 AS
    LANGUAGE JAVA NAME 'EncryptUtil.encrypt(java.lang.String ) return java.lang.String';
    Step3: Test encryption and descryption
    DECLARE
    outstr VARCHAR2(2000);
    BEGIN
    DBMS_OUTPUT.PUT_LINE('outstr-->' || SF_ENCRYPTUTIL('12345'));
    END;
    Below code example using DBMS_CRYPTO. This works, but we do not want to use this.
    declare
    l_in_val varchar2(2000) := 'Test data 123';
    l_mod number := dbms_crypto.ENCRYPT_AES128
    + dbms_crypto.CHAIN_CBC
    + dbms_crypto.PAD_PKCS5;
    l_enc raw (2000);
    l_enc_key raw (2000);
    l_dec raw (2000);
    begin
    l_enc := dbms_crypto.encrypt
    UTL_I18N.STRING_TO_RAW (l_in_val, 'AL32UTF8'),
    l_mod,
    HEXTORAW('156ae12300ccfbeb48e43aa016febb36'),
    HEXTORAW('001122230405060708090a0b0c0d0e0f')
    dbms_output.put_line ('Encrypted='||l_enc);
    end;
    Edited by: user5092433 on Sep 10, 2009 12:26 AM

    I guess I'd be a bit curious about why you can't use a DBMS_CRYPTO solution that provides identical output. It seems odd to want to have a procedure running inside Oracle and then dictate that it has to be Java and not PL/SQL...
    I verified the java.security file in jre/lib/security and I see that there is provider entry for SunJCE.
    The jre version in Oracle is 1.4.2.Which java.security file are you talking about? The JVM that is inside the Oracle database does not and can not use configuration files that are outside the database. I suspect when you talk about files and paths that you're looking at a JVM outside the database, which is not the JVM that your Java stored procedure would be using.
    Looking at the error, my assumption is that some JAR file needs to be loaded into the internal JVM in order for the AES algorithm to be available. But I'm unfortunately not familiar enough with these classes to say what that would be.
    Justin

  • Trying to encrypt and decrypt localy

    here is what i am doing
    import javax.swing.JOptionPane;
    import java.io.*;
    import javax.crypto.Cipher;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.KeyGenerator;
    import java.security.Key;
    import java.security.InvalidKeyException;
    public class LocalEncrypter
         private static String algorithm = "DESede";
    private static Key key = null;
    private static Cipher cipher = null;
    private static void setUp() throws Exception
    //this next line gets an instance of the algm to encypt and generates the key for it
         key = KeyGenerator.getInstance(algorithm).generateKey();
         //this next line creates a cipher obj for the algm.
    cipher = Cipher.getInstance(algorithm);
    public static void main(String[] args) throws Exception
         setUp();//generates key and create cipher
    FileOutputStream fos = new FileOutputStream("test.obj");
         ObjectOutputStream oos = new ObjectOutputStream(fos);
    byte[] encryptionBytes = null;
    String input = JOptionPane.showInputDialog( "enter message to encrypt");
    encryptionBytes = encrypt(input);//encyrption being performed
    oos.writeObject(encryptionBytes);
    oos.flush();
    oos.close();
    System.exit(0);
    //this method encrypts the string inputed
    private static byte[] encrypt(String input) throws InvalidKeyException,
    BadPaddingException,IllegalBlockSizeException
    cipher.init(Cipher.ENCRYPT_MODE, key);//initialized the cipher to encyption mode
    //key is used to know how to encypt
    byte[] inputBytes = input.getBytes();//gets the byte array from the sting inputed
    inputBytes = cipher.doFinal(inputBytes);//create the ciphered byte array
    return inputBytes;//returns the byte array
    //////////////////other class
    import javax.swing.JOptionPane;
    import java.io.*;
    import javax.crypto.Cipher;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.KeyGenerator;
    import java.security.Key;
    import java.security.InvalidKeyException;
    public class LocalDecrypter
         private static String algorithm = "DESede";
    private static Key key = null;
    private static Cipher cipher = null;
    private static void setUp() throws Exception
    //this next line gets an instance of the algm to encypt and generates the key for it
         key = KeyGenerator.getInstance(algorithm).generateKey();
         //this next line creates a cipher obj for the algm.
    cipher = Cipher.getInstance(algorithm);
    public static void main(String[] args) throws Exception
         setUp();//generates key and create cipher
    FileInputStream fis = new FileInputStream("test.obj");
         ObjectInputStream ois = new ObjectInputStream(fis);
    byte[] dencryptionBytes = null;
    dencryptionBytes = (byte [])ois.readObject();
    ois.close();
    for(int i=0 ; i < dencryptionBytes.length;i++)
    System.out.print(dencryptionBytes);
    System.out.println();
    String s = decrypt(dencryptionBytes);
    System.out.println(s);
    System.exit(0);
         //this method decyprts the string inputed.
    private static String decrypt(byte[] encryptionBytes) throws InvalidKeyException,
    BadPaddingException,IllegalBlockSizeException
    cipher.init(Cipher.DECRYPT_MODE, key);//initialze the cipher to decyption
    //key is used to know how to decrypt.
    byte[] recoveredBytes = cipher.doFinal(encryptionBytes);//recover the cipher text
    String recovered = new String(recoveredBytes);//create a string from the byte []
    return recovered;//return the new deciphered string.
    I encrypt fine but here is my error now i know for sure that this would work if i was using sockets cause the streams would be piped and set ok cause of tcp protocol.
    but saving it in a file or writing the object this exception occurs.
    any help guys
    C:\Documents and Settings\jimmy\Desktop\cipher>java LocalDecrypter
    -6052-5-39-33-412693
    Exception in thread "main" javax.crypto.BadPaddingException: Given final block n
    ot properly padded
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.SunJCE_h.b(DashoA6275)
    at com.sun.crypto.provider.DESedeCipher.engineDoFinal(DashoA6275)
    at javax.crypto.Cipher.doFinal(DashoA6275)
    at LocalDecrypter.decrypt(LocalDecrypter.java:56)
    at LocalDecrypter.main(LocalDecrypter.java:42)

    (your original classes with Base64 and key sharing funtionality added:)
    // ***************************************** ENCRYPT ********************************************** //
    import javax.swing.JOptionPane;
    import java.io.*;
    import javax.crypto.Cipher;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import java.security.InvalidKeyException;
    import sun.misc.BASE64Encoder;
    import sun.misc.BASE64Decoder;
    public class LocalEncrypter {
         private static String algorithm = "DESede";
         private static SecretKey key = null;
         private static Cipher cipher = null;
         private static void setUp() throws Exception {
              //this next line gets an instance of the algm to encypt and generates the key for it
              key = KeyGenerator.getInstance(algorithm).generateKey();
              //this next line creates a cipher obj for the algm.
              cipher = Cipher.getInstance(algorithm);
         private static void saveKey(String filename) throws Exception {
              byte[] byteSeed = key.getEncoded();
              BASE64Encoder encoder = new BASE64Encoder();
              String seed = encoder.encodeBuffer(byteSeed);
              FileWriter fw = new FileWriter(filename);
              fw.write(seed);
              fw.close();          
         public static void main(String[] args) throws Exception {
              setUp();//generates key and create cipher
              FileOutputStream fos = new FileOutputStream("test.obj");
              ObjectOutputStream oos = new ObjectOutputStream(fos);     
              byte[] encryptionBytes = null;
              String input = JOptionPane.showInputDialog( "enter message to encrypt");
              encryptionBytes = encrypt(input);//encyrption being performed
              oos.writeObject(encryptionBytes);
              oos.flush();
              oos.close();
              saveKey("key.txt");
              System.exit(0);
         //this method encrypts the string inputed
         private static byte[] encrypt(String input) throws Exception {
              cipher.init(Cipher.ENCRYPT_MODE, key);//initialized the cipher to encyption mode
              //key is used to know how to encypt
              byte[] inputBytes = input.getBytes();//gets the byte array from the sting inputed
              inputBytes = cipher.doFinal(inputBytes);//create the ciphered byte array
              BASE64Encoder encoder = new BASE64Encoder();
              String ciphertextB64 = encoder.encodeBuffer(inputBytes);
              return ciphertextB64.getBytes();//returns the byte array
    // ***************************************** DECRYPT ********************************************** //
    import javax.swing.JOptionPane;
    import java.io.*;
    import javax.crypto.Cipher;
    import javax.crypto.BadPaddingException;
    import javax.crypto.IllegalBlockSizeException;
    import javax.crypto.KeyGenerator;
    import javax.crypto.SecretKey;
    import javax.crypto.spec.SecretKeySpec;
    import java.security.InvalidKeyException;
    import sun.misc.BASE64Decoder;
    public class LocalDecrypter {
         private static String algorithm = "DESede";
         private static SecretKey key = null;
         private static Cipher cipher = null;
         private static SecretKey loadKey(String filename) throws Exception {
              FileInputStream fis = new FileInputStream(filename);
              byte[] encKey = new byte[fis.available()];
              fis.read(encKey);
              fis.close();
              String seed = new String(encKey);
              BASE64Decoder decoder = new BASE64Decoder();
              byte[] byteSeed = decoder.decodeBuffer(seed);
              SecretKey myKey = new SecretKeySpec(byteSeed, algorithm);
              return myKey;
         private static void setUp() throws Exception {
              //this next line creates a cipher obj for the algm.
              cipher = Cipher.getInstance(algorithm);
         public static void main(String[] args) throws Exception {
              setUp();//generates key and create cipher
              key = loadKey("key.txt");
              FileInputStream fis = new FileInputStream("test.obj");
              ObjectInputStream ois = new ObjectInputStream(fis);
              byte[] dencryptionBytes = null;
              dencryptionBytes = (byte [])ois.readObject();
              ois.close();
              for(int i=0 ; i < dencryptionBytes.length;i++)
                   System.out.print(dencryptionBytes);
                   System.out.println();
                   String s = decrypt(dencryptionBytes);
                   System.out.println(s);
                   System.exit(0);
              //this method decyprts the string inputed.
              private static String decrypt(byte[] encryptionBytesB64) throws Exception {
              BASE64Decoder decoder = new BASE64Decoder();
              byte[] encryptionBytes = decoder.decodeBuffer(new String(encryptionBytesB64));
              cipher.init(Cipher.DECRYPT_MODE, key);//initialze the cipher to decyption
              //key is used to know how to decrypt.
              byte[] recoveredBytes = cipher.doFinal(encryptionBytes);//recover the cipher text
              String recovered = new String(recoveredBytes);//create a string from the byte []
              return recovered;//return the new deciphered string.

  • How do I encrypt my external hard drive and subsequently a specific file within it, using my Mac? I tried creating a disk image but permission was denied.

    Encrypting an external hard drive and specific folders within. Permission denied using disk image.

    VKP90 wrote:
    When I tried to encrypt a single file within the hard drive itself, I got the following: Disk Utility Progress: Unable to create "Name of my file" (Permission Denied).
    When I tried encrypting the entire hard disk itself, I got: A GUID Partition Table (GPT) partitioning scheme is required.
    I have also currently used Time Machine on the external hard drive, along with saving other data. Hence, I am not sure if partitioning is going to delete any of this (a video I watched mentioned that using the + button when creating partitions retains current data). Backing up the external hard drive is out of the option since it is the back up to my Mac.
    You can't encrypt a single file. I'm not sure what you did to try. You can make an encrypted disk image which begins with a folder, if desired. Or, you can just create a blank, encrypted disk image, then move your desired files into that.
    While you could partition off the free space without erasing the disk, you cannot encrypt it because you need a GUID Partition table which requires you to repartition the entire drive, not just the free space.

  • Encrypt custom attribute

    Tar: 7340338.994
    OID Version: 10.1.2.0.2
    We are trying to encrypt the custom attribute ( ssn, answer ). How do we encrypt the custom attribute ? This is security requirement.
    I find nothing in the admin guide and I am not even sure we can do this. Does anyone know how to encrypt a custom attribute?
    I am thinking at best this is an Enhancement Request.

    Several ways:
    1. Write a plugin: http://download.oracle.com/docs/cd/B14099_19/idmanage.1012/b14082/plugin_intr.htm#i120282
    2. Put OVD in front of OID, point the application to OVD and write a plugin for OVD: http://download.oracle.com/docs/html/E12283_01/java_plug_ins.htm#CIHBDHHE
    3. If you can find the attribute in ODS schema, try encryption at the database level with TDE or VPD. Actually I am not sure it will carry over to LDAP interface..probably not but it's worth a try
    4. Have the application do it?

  • Storing Encrypted passwords in SQL database

    Hey folks!
    I'm trying to encrypt a password to be put into a SQL database and then be decrypted when I pull it out to log a user in. Currently I can encrypt and store the password fine, but it's the grabbing and decrypting that is giving me troubles.
    Sometimes I do get the correct string back from the decrypted database string, but not very often. The main error I get is BadPaddingException, which I've read in the forum is something to do with key/string descrepancies. I sometimes get a IllegalBlockSizeException as well.
    When I look at the ASCII bytes stored in the database they are different from what is shown when I print them out on the screen using IE5.5.
    I'm wondering if anyone out there has run into similar problems and overcame, or could help me along in the right direction. Thnx!
    PJ

    What you need to do is a combination of what has been said here. Let's say you are working with a MS SQL Server, encrypting with 3DES. You have your key located somewhere on the system and use that (or something else that is specific to that record).
    1.) In your app, encrypt the text
    2.) Base64 Encode it so you can shove it in the database (I have also put this as RAW bytes in an Oracle DB)
    3.) make sure, when you are testing, that you check the length of the Base64 Encrypted Text you put in the database. SQL Server might add on extra characters to fill the field. i.e. if you are storing it in a varchar(250) field and you only fill 50 chars with your encrypted password, SQL Server might pad it with the extra 200. This will mess with your padding and throw an exception during the decryption process. I think I got around this with a simple TRIM statement when retrieving.
    4.) Retrieve the text with a SQL statement
    5.) Base64 Decode the text to get a byte array
    6.) Use the decryption algorithm with your original key on the byte array.
    I think that's it. Very quick. Low overhead on the server. Optimally, you would want to clear this from memory...blah blah blah....I could go on ;-p
    I have a small API I've written for this using 3DES that has been working great ever since JCE 1.0. All I have to do is keygen a new key whenever I want to use it again.
    Hope this helps,
    RG

  • Creating Encrypted Time Machine Back Ups to a Network Hard Drive

    Hello all, I can't seem to create an encrypted Time Machine back up on a network hard drive.  Can this be done?  And if not, why not?  It seems that Macs have all the necessary functionality already available in Mac OS. Time Machine can create encrypted backups with multiple computers so what's the difference if it is to a network backup drive, honestly?  Any suggestions?
    My Set up:  Three Macs, Airport Extreme Base Station, Seagate 3 TB HD (with separate partitions for each computer's backups).  2 of the Macs use ethernet to connect to the network and one uses wireless regularly.  Basically, I'm trying to encrypt my family's backup drive and I don't know how or why I can't.
    Thanks in advance for the help.
    Appleguy514

    First, you need to know that backing-up that way is unreliable and not supported by Apple.   See:  Using Time Machine with an Airport Extreme Air Disk.
    Second, no, you cannot encrypt a network backup on Lion or earlier.  Only Mountain Lion.

  • Bitlocker with PIN and can't encrypt second drive

    I have my OS drive encrypted, and have a boot PIN. All is well. I'm trying to encrypt the data drive in my laptop, and I'm getting a prompt
    "The Group Policy settings for BitLocker startup options are in conflict and cannont be applied". The options are configured as this:
    Configure TPM startup: Allow TPM
    Configure TPM startup PIN: Allow startup PIN with TPM
    Configure TPM startup key: Allow startup key with TPM
    Configure TPM startup key and PIN: Allow startup key and PIN with TPM
    I've tried setting the bottom two to not allow, but that doesn't seem to matter. I've verified that there are no domain GPOs that adjust these settings.
    What am I missing?

    Hi,
    How did you encrypt the data drive? Which settings did you change?
    For the Fixed Data Drives encryption, the group policy located here:
    Computer Configuration\Windows Components\BitLocker Drive Encryption\Fixed Data Drives
    It seems your operating system drive encryption group policy is correctly configured.
    Use the command gpresult /h gpreport.html to export the group policy settings, check if there's any clue.
    And, this is for your reference:
    Best Practice for BitLocker
    Regards,
    Miya 
    TechNet Subscriber Support in forum. If you have any feedback on our support, please contact
    [email protected]
    Miya Yao
    TechNet Community Support

  • How do I encrypt a flash drive

    Hello,
              Im trying to encrypt my flash drive, but when I try it says A GUID Partitioning Table (GPT) partitioning scheme is required, but I also want it to work for Mac and Windows if I can, how do I do it?

    If you need an encryption you can share between mac and windows, I'd advise you to use something like truecrypt.
    You create a crypted container (the name you want) that you can mount as a drive. The app itself can be stored on the key as a portable app for windows.

Maybe you are looking for

  • Placing fields in a position

    hi everyone,   U had given right answer but the thing is how can i place these dynamically created input fields in the required position just like (x,y)co-ordinates. example: top of the screen or bottom of the screen or some other place on the browse

  • My HP Photosmart 8250 will not print in black.

    Hi, My HP Photosmart 8250 will not print in black. I saw previous posts stating that it will not print in black if any of the color cartridges are empty, but all of the cartridges have ink. Thank you!

  • Business Partner Transfer using ALE/IDOCS

    Dear Gurus, I am using S.R.M. 5.0 system. I am encountering scenario of transferring the business partners from S.R.M sytem to C project which is again add-on module provided by SAP. I have created Distribution Model and have assigned the message typ

  • Apple Mini-Port to Video (S-Video) for monitoring

    Hi All, Do Apple mini-port video (or s-video) out to consumer LCD TV c'ld be a monitor for editing? Will this still a Progressive out as what DVI or VGA out?

  • Clearing postings by bank statement program FF_5

    Hello the bank statement program clears open items on customers (invoices customers paid) and on bank sub accounts (gl accounts with open item management). (for vendor invoices where we gave payment orders by running the payment run) Does the system