Encrypt / Decrypt password

Hi
I'm new in Java and I need to create a function to encrypt / decrypt passwords using the Blowfish algorithm. I know how to create a key, but I don't know how to recover it to decrypt the password.
Another question, Is it possible to use public/private keys in this case???.
Can you give some links or examples please???
Regards
J.C.

This is typically done either one of two ways:
1) PBE based encryption. This uses a password or pass phrase to derive
a key to use with a symmetric algorithm.
2) Asymmetric using something like RSA. Typically RSA is used to wrap
the actual symmetric key used to do the encryption but for very short
plaintext it can be used directly on the plaintext. Passwords are a
good example of short plaintext.
Obviously symmetric encryption is a great deal faster than asymmetric
encryption. So if your plaintext was large you would want to use
symmetric. Also Asymmetric encryption is length dependant. AKA if your
public key's modulus is 1024 bits then you could encrypt any plaintext
that was 121 bytes or shorter.
PBE takes a salt (a random byte array) and an iteration count and
hashes a passphrase with the salt iteration number of times to generate
a key that can be reproduced over and over again and used with a
symmetric algorithm. The issue here is that your salt/ic either need
to be hard coded and reused or the values for any single encryption
need to be saved along with the ciphertext. Using the same ic/salt for
a large number of plaintext to ciphertext operations can lead to a
weakening of the pass phrase (aka the key) and aids a cryptoanalyst in
breaking the code. Although it is still difficult it becomes easier
with each successive encryption.
Its upto you which route you take but you should note that private keys
used in asymmetric encryption use PBE to keep them private anyway so in
a sense if you use asymmetric encryption you are really using both
asymmetric encryption and PBE...

Similar Messages

  • Error running SSIS package to do with encrypting/decrypting password. Help needed.

    Getting this error. Can anyone shed some light? This is the first promote since 2009. Protection level of the package is 'EncryptSensitiveWithPassword' I'm new at SSIS so don't assume I know anything.
    10/30/2014 16:11:06,HPAddress_Export,Error,0,SSQLTST01\SSQLTST02,HPAddress_Export,(Job outcome),,The job failed. 
    The Job was invoked by User AHCCCS\Administrator.  The last step to run was step 1 (Step 1).,00:00:02,0,0,,,,0
    10/30/2014 16:11:06,HPAddress_Export,Error,1,SSQLTST01\SSQLTST02,HPAddress_Export,Step 1,,Executed as user: AHCCCS\svcssqltst01. ....00.5324.00 for 32-bit 
    Copyright (C) Microsoft Corp 1984-2005. All rights reserved.   
    Started:  4:11:06 PM  Error: 2014-10-30 16:11:07.05    
    Code: 0xC001405F     Source:      
    Description: Failed to decrypt an encrypted XML node because the password was not specified or not correct. Package load will attempt to continue without the encrypted information. 
    End Error  Error: 2014-10-30 16:11:07.37    
    Code: 0xC001405F     Source:      
    Description: Failed to decrypt an encrypted XML node because the password was not specified or not correct. Package load will attempt to continue without the encrypted information. 
    End Error  Error: 2014-10-30 16:11:07.79    
    Code: 0xC0202009     Source: HPAddress_ExportPackage Connection manager "SQL.HealthPlanAddressChanges.hpac"    
    Description: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80040E4D. 
    An OLE DB record is available.  Source: "Micros... 
    The package execution fa...  The step failed.,00:00:02,0,0,,,,0

    Hi,
    From the error message “Failed to decrypt an encrypted XML node because the password was not specified or not correct. Package load will attempt to continue without the encrypted information.“, it seems that the error is caused by the password to decrypt
    an encrypted XML node was not specified or incorrect.
    Besides, the EncryptSensitiveWithPassword Protection level means user should use a password to encrypt only the values of sensitive properties in the package. To open the package in SSIS Designer, the user must provide the package password. If the password
    is not provided, the package opens without the sensitive data and the current user must provide new values for sensitive data. If the user tries to execute the package without providing the password, package execution fails.
    So in order to resolve this issue, we should provide the password when executing the package. When you execute a package with this setting using DTEXEC, you can specify the password on the command line using the /Decrypt password command line argument.
    Reference:
    Access Control for Sensitive Data in Packages
    Securing Your SSIS Packages Using Package Protection Level
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Encrypt/Decrypt passwords

    Hi...
    Another thread with that same, old subject... right? Perhaps yes!! But I am not able to move further without help.
    I am developing an application where user needs to login by entering the password. My requirement is to encrypt the password first (while registering the user) and store it in a database (using MS Access 2007). Later, while logging in, I need to decrypt that stored password and validate the entered password by user.
    As I am quite new to this, not able to understand how to proceed. Checked in this forum, even in net - got many stuffs as well - but still I am not able to develop this.
    Any suggestion, help would be appreciated.
    I have few simple logics, that could be used: 1. replace each characters with the next (or next to next) characters, 2. insert some junk characters in between each characters and creating a string... etc
    But I am looking for some serious encryption/decryption techniques.
    Thanks in Advance...

    >
    Oh yeah.. what an 'Aloo Paratha' with no salt. But not able to understand how to add this 'Salt' to my paratha.. :(
    TiA...Suppose I had read access to the password table, where I also had an account:
    | user_name | digested_password | ...
    +-----------+-------------------+--
    | bdlh      | efagukfuilfehilef |
    | smith     | fiopwefiopf890fnk |
    ...I can't guess smith's password from his digest, but what if I notice:
    | user_name | digested_password | ...
    +-----------+-------------------+--
    | bdlh      | efagukfuilfehilef |
    | smith     | fiopwefiopf890fnk |
    | kumar     | efagukfuilfehilef |Hey! kumar and I happen to have the same digest! We have the same password! (Or as good as.) I can log on as kumar and have jolly time at his expense.
    Now change things with a pinch of salt: a randomly generated unique string. One's digested_password is actually the digest of password+salt:
    | user_name | digested_password | salt     |
    +-----------+-------------------+----------+
    | bdlh      | efagukfuilfehilef | efaghkku |
    | smith     | fiopwefiopf890fnk | h23bh9m0 |
    | kumar     | vjlvsr8u0w780w4bj | 789r2bh7 |Now even if kumar and I happen to have the same password, our salts make the digests different.
    As for "how to digest", use MessageDigest: [http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html]

  • Please Help!!!  Encrypt/Decrypt Password

    i'm a newbie to Cryptography...and i know that this question have been asked MILLIONS of time...but i'm going to ask it again. i searched through the forum, and i didn't find anything useful...but:
    i want to write a program to encrypt the password i type in the JPasswordField...save it out to a Properties file...when i'm trying to authentication, get the password...decrypt the password...and authentication.
    i pretty much have the JPasswordField and Properties file done...i just need the encryption and decryption left.
    can someone please help??? please post example code...please don't suggest hashcode!!!
    sin sai

    Try this, found at:
    [ http://java.ittoolbox.com/documents/document.asp?i=1676 ]
    You can convert your password to MD5 format as follows:
    import java.security.*;
    import java.lang.*;
    public class PasswordEncrypt {
    * Constructor for the PasswordEncrypt object
    public PasswordEncrypt() { }
    * This is the method which converts the any string value to MD5
    format.
    *@param str password
    *@return encrypted password in MD5
    public String encrypt(String str) {
    StringBuffer retString = new StringBuffer();
    try {
    MessageDigest alg = MessageDigest.getInstance("MD5", "SUN");
    String myVar = str;
    byte bs[] = myVar.getBytes();
    byte digest[] = alg.digest(bs);
    for (int i = 0; i < digest.length; ++i) {
    retString.append(Integer.toHexString(0x0100 + (digest[i] &
    0x00FF)).substring(1));
    } catch (Exception e) {
    System.out.println("there appears to have been an error " + e);
    return retString.toString();
    ---

  • Operations on Text File - Encrypt, Decrypt, Password Protected

    Dear Experts,
    My requirement is to upload a text file  and do some operations on it and then encrypt the content in it ans save it on application server with password protected. Later i want to decrypt it.
    Please help me for the following:
    How to encyypt and decrypt the text file using standard encryption alogrithms like DES, MD5, RSA? Are there any standand function modules for both encryption and decryption which accepts a user defined public key?
    How to download a password protected text file?
    Thanks in advance.

    CALL FUNCTION 'Z_CRYPT_FILE'
            EXPORTING
              SOURCE_PATH         = WS_PATH
              SOURCE_FILE         = WS_OLDFILE
              DESTINATION_PATH    = WS_NEW_PATH
              DESTINATION_FILE    = WS_NEWFILE
              SWITCH              = 'E'
              KEY                 = ZUSER_PW
              KEEP_SOURCE_FILE    = ' '
            EXCEPTIONS
              INVALID_SWITCH      = 1
              SOURCE_FILE_NOTFOUND = 2
              DIDNT_WORK          = 3.
    FUNCTION MODULE Z_CRYPT_FILE 
    DATA: CINPUT(300) TYPE C.
    DATA: BEGIN OF LIST OCCURS 0,
            DATA(238) TYPE C,
            DELIMITER(04) TYPE C,
            FILE(12) TYPE C,
          END OF LIST.
    DATA: SOURCE TYPE ZCHAR200.
    DATA: DESTINATION TYPE ZCHAR200.
    DATA: ZINDX TYPE I.
    DATA: msg(100).
    IF SWITCH = 'E'.
       IF FILETYPE = 'T'.
          OPEN DATASET SOURCE IN TEXT MODE FOR INPUT ENCODING DEFAULT
             message msg.
       ELSE.
          OPEN DATASET SOURCE IN BINARY MODE FOR INPUT message msg.
       ENDIF.
       IF SY-SUBRC <> 0.
          RAISE SOURCE_FILE_NOTFOUND.
       ENDIF.
       CLOSE DATASET SOURCE.
       CLEAR CINPUT.
       CONCATENATE '/usr/local/bin/gpg -sev -r'
        KEY
        '-o'
        DESTINATION
        SOURCE
       INTO CINPUT SEPARATED BY SPACE.
       CONCATENATE CINPUT '2>&1' INTO CINPUT SEPARATED BY ' '.
       CALL 'SYSTEM' ID 'COMMAND' FIELD CINPUT ID 'TAB' FIELD
                                  LIST-SYS.
       IF FILETYPE = 'T'.  
          OPEN DATASET DESTINATION IN TEXT MODE FOR INPUT ENCODING DEFAULT
             message msg.
       ELSE.
          OPEN DATASET DESTINATION IN BINARY MODE FOR INPUT message msg.
       ENDIF.
       IF SY-SUBRC = 0.
          CLOSE DATASET DESTINATION.
          IF keep_source_file <> 'X'.
             CLEAR CINPUT.
             CONCATENATE 'rm' SOURCE INTO CINPUT
             SEPARATED BY SPACE.
             CALL 'SYSTEM' ID 'COMMAND' FIELD CINPUT ID 'TAB' FIELD
                            LIST-SYS.
          ENDIF.
       ELSE.
        write: 'Encryption error  on command: ',
           cinput.
        skip 1.
         loop at list.
            write: / LIST.
           endloop.
          RAISE DIDNT_WORK.
       ENDIF.
       IF FILETYPE = 'T'.  
          OPEN DATASET SOURCE IN TEXT MODE FOR INPUT ENCODING DEFAULT.
       ELSE.
          OPEN DATASET SOURCE IN BINARY MODE FOR INPUT.
       ENDIF.
       IF SY-SUBRC <> 0.
          RAISE SOURCE_FILE_NOTFOUND.
       ENDIF.
       CLOSE DATASET SOURCE.
       CLEAR CINPUT.
       CONCATENATE '/usr/local/bin/gpg -o'
        DESTINATION
        SOURCE
       INTO CINPUT SEPARATED BY SPACE.
       CONCATENATE CINPUT '2>&1' INTO CINPUT SEPARATED BY ' '.
       CALL 'SYSTEM' ID 'COMMAND' FIELD CINPUT ID 'TAB' FIELD
                                  LIST-SYS.
      REFRESH LIST.
      CLEAR LIST.
       IF FILETYPE = 'T'. 
          OPEN DATASET DESTINATION IN TEXT MODE FOR INPUT ENCODING DEFAULT.
       ELSE.
          OPEN DATASET DESTINATION IN BINARY MODE FOR INPUT.
       ENDIF.
       IF SY-SUBRC = 0.
          CLOSE DATASET DESTINATION.
       ELSE.
    *list output if error
          loop at list.
            write: / LIST.
           endloop.
          RAISE DIDNT_WORK.
       ENDIF.
    ENDIF.

  • Encrypt/decrypt streams with same password

    Hi all!
    I'would like to know if I can encrypt/decrypt streams using key's which are hardwired in my application. By a hardwired key I understand a key which is generated using the same seed; practically I don't keep the key, but the minimum info to regenerate it.
    Is this possible and if yes, how? Where can I find some more info about regenerating a key?
    Stefan.
    PS: I'm a newbie in field of cryptography, so...

    You can use password-based encryption. See an example
    of such a thing in:
    http://javaalmanac.com/egs/javax.crypto/PassKey.html
    Erm, what sort of encryption isn't password-based ?

  • How to encrypt/decrypt the password

    Hi
    In our website(JSP,servlet) is running over the Sun One Application server.In website, Contact us information is call by a servlet.when we submit the information and it will connect to the DB. I need to use encrypt/decrypt the password. DB connection information is store in server.xml.
    So how to proceed to encrypt/decrypt the password?
    please advice/suggestion for the same.
    thanks
    lalit
    Edited by: Lalit107 on Aug 6, 2009 4:49 AM

    I don't understand what you are saying. Is your password sumitted from the JSP?

  • Encrypt/decrypt same file with two different passwords

    Hi everyone:
    I'm quite new to Java and cryptography in general and have a theoretical question. Is the following scenario possible and how would it be implemented:
    Two users with two passwords (say, a regular user and a superuser) encrypt, decrypt, read from and write to the same file. The secret key for encryption and decryption should be based on their passwords (generated from their passwords), i.e. not stored anywhere on the system.
    I've been racking my brains but can't think of a way. Am I missing an obvious solution?
    Can it be done?
    Thanks,
    Michael

    I don't think you can avoid having more than just a password hash stored on the system. Using a combination of my approach and Jeff's approach I can implement this as long as you allow a password protected key store to be stored on each system. A given user's key store would contain his RSA private key and associated public key together with the admin user's RSA certificate (thought the admin user's public key could be stored in the program since it does not have to be kept private). The admin user's key store would contain only his RSA private and public keys.
    Assume that the data file is to be create by a standard non-admin user. His code performs the following actions -
    1) Generates a random symmetric algorithm key. Say a 128 bit AES key.
    2) He write a digest of this to the output file.
    3) He writes the random key encrypted with his public key to the file.
    4) He writes his public key (or certificate) to the file.
    5) He writes the random key encrypted with the admin users public key to the file.
    6) He encrypts the data using the random key writes the result to the file.
    This user can then update the file by
    1) reading from the file the digest of the random key.
    2) reading the random key encrypted with his public key.
    3) Decrypting this encrypted random key using his private key extracted from his keystore.
    4) Check the digest of this key to make sure he has the correct random key.
    5) skipping his certificate and the random key encrypted using the admin user's public key.
    5) Decrypting the data using the random key.
    6) Update the data.
    7) Re-encrypt the file as described in the first part using a new random key.
    The admin user can
    1) read from the file the digest of the random key.
    2) skip the random key encrypted using the user's public key.
    3) reading the user's public key from the file (for use later if the file needs to be updated).
    4) read the random key encrypted using the admin's public key.
    5) decrypting the random key using the admin's private key obtained from his key store.
    6) check the digest of the random key to make sure it is correct.
    7) decrypt the the data.
    The admin can edit the data since he can re-encrypt the data in a similar manner to the way it was created in the first place.

  • How to Encrypt - Decrypt the Passwords

    Hi,
    i am developing an integration between SAP and SFTP.
    i want to save the encrypted password of SFTP to database tables and then i want to use the decrypted password to connect SFTP.
    how to convert the encrypted password to decrypted?
    can somebody help me please?
    Best regards.

    Hi
    you will have to encrypt the entered password first and compare the encrypted passwords.
    Im not sure, but maybe FM VRM_COMPUTE_MD5 will do the encrypting-job.
    just check it out and also check below FM
    Try the DB_CRYPTO_PASSWORD function module, there's no way to decrypt it back that I know of. You just pass the user input to the function module and compare the encrypted output to the value stored in the database.
    and also try this two
    Use the following FM to encrypt
    CALL FUNCTION 'FIEB_PASSWORD_ENCRYPT'
    Use the following FM to decrypt
    CALL FUNCTION 'FIEB_PASSWORD_DECRYPT'
    By these FM you can encrypt & decrypt any fields of the Program.
    Warm Regards
      NZAB

  • Encryption/Decryption  failure for pdf and MSWord files

    Hi,
    Is there anybody to help me to find out what is wrong with my class (listing below)? I am sucessfuly using this class to encrypt and decrypt txt, html files but for unknown reasons I am unable to use it for e.g. pdf files. The encrypion somehow works but any atempt to decrypt is a failure.
    /* This class accepts an input file, encrypts/decrypts it using DES algorithm and
    writes the encrypted/decrypted output to an output file. DES is used in Cipher
    Block Chaining mode with PKCS5Padding padding scheme. Note that DES is a symmetric
    block cipher that uses 64-bit keys for encryption. A password of length no less
    than 8 is to be passed to the encryptFile/ decryptFile methods. This password is
    used to generate the encryption key. All exception handling is to be done by
    calling methods. These exceptions are thrown by encryptFile/ decryptFile methods.
    The input buffer is 64 bytes, 8 times the key size.
    import java.io.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.security.*;
    import java.security.spec.*;
    public class Crypto
    public Crypto(FileInputStream inStream_, FileOutputStream outStream_)
    fInputStream_ = inStream_;
    fOutputStream_ = outStream_;
    public void encryptFile(String password_) throws InvalidKeySpecException, InvalidKeyException,
    InvalidAlgorithmParameterException, IllegalStateException, IOException, Exception
    DataOutputStream dataOutStream_ = new DataOutputStream(fOutputStream_);
    // key generation
    SecretKey encryptKey_ = createEncryptionKey(password_);
    // Cipher initialization
    Cipher cipher_= Cipher.getInstance(cipherType);
    cipher_.init(Cipher.ENCRYPT_MODE, encryptKey_);
    // write initialization vector to output
    byte[] initializationVector_ = cipher_.getIV();
    dataOutStream_.writeInt(initializationVector_.length);
    dataOutStream_.write(initializationVector_);
    // start reading from input and writing encrypted data to output
    while (true) {
    inputLength_ = fInputStream_.read(input_);
    if (inputLength_ ==-1) break;
    byte[] output_ = cipher_.update(input_, inputOffset_, inputLength_);
    if (output_ != null)
    dataOutStream_.write(output_);
    // finalize encryption and wrap up
    byte[] output_ = cipher_.doFinal();
    if (output_ != null)
    dataOutStream_.write(output_);
    fInputStream_.close();
    dataOutStream_.flush();
    dataOutStream_.close();
    public void decryptFile(String password_) throws IllegalStateException, IOException, Exception
    DataInputStream dataInStream_ = new DataInputStream(fInputStream_);
    // key generation
    SecretKey encryptKey_ = createEncryptionKey(password_);
    // read initialization vector from input
    int ivSize_ = dataInStream_.readInt();
    byte[] initializationVector_ = new byte[ivSize_];
    dataInStream_.readFully(initializationVector_);
    IvParameterSpec ivParamSpec_= new IvParameterSpec(initializationVector_);
    // Cipher initialization
    Cipher cipher_= Cipher.getInstance("DES/CBC/PKCS5Padding");
    cipher_.init(Cipher.DECRYPT_MODE, encryptKey_, ivParamSpec_);
    // start reading from input and writing decrypted data to output
    while (true) {
    inputLength_ = fInputStream_.read(input_);
    if (inputLength_ ==-1) break;
    byte[] output_ = cipher_.update(input_, inputOffset_, inputLength_);
    if (output_ != null)
    fOutputStream_.write(output_);
    // finalize decryption and wrap up
    byte[] output_ = cipher_.doFinal();
    if (output_ != null)
    fOutputStream_.write(output_);
    fInputStream_.close();
    fOutputStream_.flush();
    fOutputStream_.close();
    // the following method creates the encryption key using the supplied password
    private SecretKey createEncryptionKey(String passwd_) throws InvalidKeySpecException,
    InvalidKeyException, NoSuchAlgorithmException
    byte[] encryptionKeyData_ = passwd_.getBytes();
    DESKeySpec encryptionKeySpec_ = new DESKeySpec(encryptionKeyData_);
    SecretKeyFactory keyFactory_ = SecretKeyFactory.getInstance(algorithm_);
    SecretKey encryptionKey_ = keyFactory_.generateSecret(encryptionKeySpec_);
    return encryptionKey_;
    private FileInputStream fInputStream_;
    private FileOutputStream fOutputStream_;
    private final String algorithm_= "DES";
    private final String cipherType= "DES/CBC/PKCS5Padding";
    private byte[] input_ = new byte[64]; // The input buffer size is 64
    private int inputLength_;
    private final int inputOffset_= 0;
    }

    Please can u give me refined code for me///
    at [email protected]
    Hi,
    I found at least one thing wrong. In the decrypt
    method you are reading from 'fInputStream_' rather
    than 'dataInStream'.
    Worked for me on MSWord after changing this!
    Roger
    // start reading from input and writing decrypted
    ted data to output
    while (true) {
    inputLength_ = fInputStream_.read(input_);
    if (inputLength_ ==-1) break;
    byte[] output_ = cipher_.update(input_,
    input_, inputOffset_, inputLength_);
    if (output_ != null)
    fOutputStream_.write(output_);

  • Help for a newbie on encryption/decryption

    I want to start with a text file.
    Read in a line of ascii characters, encrypt it using some algorithm and output it as a new set of ascii characters.
    What algorithm should I use?

    thanks a lot. I got the encryption/decryption working pretty easily.
    However, I ran into problem when I got to storing keys:
    I stored it fine with this code
              try {
                   KeyGenerator keyGen = KeyGenerator.getInstance("DES");
                   desKey = keyGen.generateKey();
                   cipher = Cipher.getInstance("DES");
                   KeyStore keyStore = KeyStore.getInstance("JKS");
                   String password = "lemein";
                   char passwd[] = password.toCharArray();
                   keyStore.load(null, passwd); //initialize keyStore
                   Certificate[] chain = new Certificate[1];
                   String alias = "test";
                   keyStore.setKeyEntry(alias, desKey, passwd, null);
                   String fileName = "data/gkey.txt";
                   FileOutputStream f = new FileOutputStream(fileName);
                   keyStore.store(f, passwd); // <----------exception happens here
              } catch (Exception e)
              {     e.printStackTrace();
    I got problem when I retrieve it with this code
              KeyGenerator kg = null;
              Key key = null;
              cipher = null;
              Security.addProvider(new com.sun.crypto.provider.SunJCE());
              byte[] result = null;
              try {
                   KeyStore keyStore = KeyStore.getInstance("JKS");
                   keyStore.load(new FileInputStream("data/gkey.txt"), "lemein".toCharArray());
                   key = keyStore.getKey("test", "lemein".toCharArray());
                   cipher = Cipher.getInstance("DES");
                   byte[] data = "Hello World!".getBytes();
                   System.out.println("Original data : " + new String(data));
                   cipher.init(Cipher.ENCRYPT_MODE, key);
                   result = cipher.doFinal(data);
                   System.out.println("Encrypted data: " + new String(result));
              } catch (Exception e) {
                   e.printStackTrace();
    I get the error:
    java.security.UnrecoverableKeyException: DerInputStream.getLength(): lengthTag=75, too big.
         at sun.security.provider.KeyProtector.recover(Unknown Source)
         at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
         at java.security.KeyStore.getKey(Unknown Source)
    Any idea what the problem is?
    Thanks

  • Encrypt Decrypt in RSA or DSA

    hai all
    how to encrypt and dcrypt using RSA DSA ?????? how secured using RSA or DSA instead of SHA
    please explain
    Thans
    below a code using SHA
    public String encrypt(String password)throws NoSuchAlgorithmException
    MessageDigest sha = null;
    byte[] b1 = new byte[password.length()];
    b1 = password.getBytes();
    sha = MessageDigest.getInstance("SHA");
    sha.reset();
    sha.update(b1);
    byte[] hash = sha.digest();
    StringBuffer buf = new StringBuffer();
    for(int i=0; i<hash.length;i++)
    buf.append(hash);
    return buf.toString();
    pls give me a decrypt function pls ...
    thakns you .

    Um...you really need to read up on how crypto works. Try "Applied Crytography", by Bruce Schneier. There is no short answer to your questions, because the questions themselves are fatally flawed.
    RSA is a public-key encryption cipher.
    DSA is an algorithm for signing content, not encrypting it.
    SHA is a Message Digest Algorithm. It's one-way - it cannot be "decrypted".
    Good luck - and good reading,
    Grant

  • Error in running encryption/decryption using DES in Websphere Dev't Client

    Hello!
    I have a code used to encrypt / decrypt a string (password). I have already tested it using Netbeans and it is working. But when I tried to add the java code to an existing web project using Websphere Development Client,, javax.crypto.* is not recognized. Then I imported JCE.jar.
    The java code contains no errors then, but when I started to run the project, it gives an Error 500. And below is the Console's error message:
    E SRVE0026E: [Servlet Error]-[javax.crypto.spec.PBEKeySpec: method <init>&#40;[C[BI&#41;V not found]: java.lang.NoSuchMethodError: javax.crypto.spec.PBEKeySpec: method <init>([C[BI)V not found[/b]
    Have I missed something to add? Or other things that I should do upon importing this jar file?
    Please help.
    Advance thanks for your reply.
    misyel

    I dont know what version of Java that my Websphere's using. But I am very sure that it is outdated. I am using Websphere 5.0. For Netbeans, it is JDK1.5.
    I imported the JCE from JDK 1.5 on Websphere.
    I think the code works perfectly fine. Actually it was my friend's code for encryption but they are using Eclipse for development (almost the same from Websphere but somehow different from it.)
    My idea is that I cant match the versions of the jarfiles used in my project. As much as I wanted to change the imported jar files, I couldn't for when I replaced the existing jar files, more and more errors occur.
    can we have any alternative ways of importing the jar files? or is there any other code that might help that will not use the JCE.jar?
    I really appreciate your response. thanks
    misyel

  • Regarding encryption/decryption in sender HTTP Adapter...

    Hi experts,
              I have  a doubt that ... is there any possible ways to encrypt/decrypt the username, password  using sender side Plain HTTP adapter.
    Regards,
    Sasitharan

    hi
    You can use those adapters to define transport level security(HTTPS/FTPS) and message level security (encryption).
    hi check this thread for refernce:
    How to use the Private/Public Keys from the Key Store
    Also check this document on encryption in adpaters:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/482aae19-0301-0010-3485-8efd618818d0
    Check security settings section of this page:
    http://help.sap.com/saphelp_nw04/helpdata/en/da/7a2f41b239a831e10000000a1550b0/content.htm
    Check thiss blog as well:
    /people/varadharajan.krishnasamy/blog/2007/05/11/how-to-use-digital-certificates-for-signing-encrypting-messages-in-xi
    regards
    chandrakanth

  • Make a field encrypted like password field

    Hi,
    I want to make a text field encrypted like password field in find user form so that that filed comes as dot when a user enter that field. For that I made secret = true for that field. But after doing that the find user form is not working for that text field (search criteria). I think we need to decrypt that field as well to make the search functionality working. But I am unable to-do that.pleases help.

    In addition to secret = true, try to add noEncrypt = true on that Field.

Maybe you are looking for

  • How do I convert a document created in pages into a pdf document?

    I created a document in pages of my macbookpro, and now I need to convert into a pdf or doc,docx,htm,html,odt,pdf,rtf,tif,tiff,txt > Help will be apreciated.

  • Performance costs of throwing an Exception

    Hi people. I was just reading another post around here, and I became curious about how much the Exception mechanism could become an overhead... I made a simple (REALLY simple) little test class, and I was shocked to perceive that actually throwing an

  • ConcurrentHashMap keySet(), entrySet(), values() thread-safety?

    hi all, just wondering why this code is valid? (Taken from java.util.concurrent.ConcurrentHashMap in jdk1.6.0_07): transient Set<K> keySet; transient Set<Map.Entry<K,V>> entrySet; transient Collection<V> values;and further down: public Set<K> keySet(

  • Result size

    Hi all, I would want to find the best way (in terms of performance) of fetching a huge number (approx. 100, 000, eack record abt 1k) records from my Oracle 8i database. Am using JDK 1.2.2 at the moment. Also, I would not want it to be a memory intens

  • Lost Session

    I have a confusing session problem. Or maybe i just don't understand how they work. I have a checksession.jsp page that is "protected" by <%@page language="java"%> <% if(session.getAttribute("auname") == null) { %> <jsp:forward page="login.jsp" /> <%