Converting from Tcl to Java...need to decode passwords stored in DB

Hello:
I am converting an application that was previously coded in Tcl/Vignette to Java. Part of this application is a login process. There are already passwords established for thousands of users and I need to be able to have Java decode these passwords from the DB when the users log in. The Vignette Tcl method used to encode the passwords previously was ENCODE64.
I am almost completely ignorant of doing encrypting/decrypting in Java. can someone give me some idea of what I can use to be able to encode incoming passwords at login so that they can match with the ENCODE64 passwords that exist in the database??
Basic lgoic is this (pseudocode):
login = false
encryptedPassword = encrypt(password_in)
if encryptedPassword = dbPassword then set login = true
Does that make sense??
Thanks!
Brian

The Bouncy Castle JCE provider (www.bouncycastle.org) has Base64 encoder/decoder classes that 'just work'.
import org.bouncycastle.util.encoders.Base64;
String base64encodedString = "ABCKD4632adcomd";
byte[] decoded = Base64.decode(base64encodedString);
String reencoded = new String(Base64.encode(decoded));As for your second question re: how should you re encrypt the passwords? The standard, quite secure way of doing this is to use a one-way cipher. This will encrypt the password text to an unintelligible mess, that CANNOT be decrypted back to the original.
When a new user enters their password for the first time, you use your cipher to encrypt it, and store this (not the actual password).
To verify this user, you take the password they give you, encrypt it in the same way, and compare the results.
Unix/Linux can use a shell command called 'crypt' to do exactly this... MySQL will also do it for you... INSERT INTO blah VALUES(CRYPT('blahpasswordstring'), and SELECT * FROM blah WHERE password=CRYPT('enteredpassword')).
... and its far too early in the morning, and I cant for the life of me remember the JCE equivalent of this function :(

Similar Messages

  • Convert from php to java

    Hello all,
    Can someone convert this code from php to java.
    <?php
    function bitbybit_crc32($str,$first_call=false){
    //reflection in 32 bits of crc32 polynomial 0x04C11DB7
    $poly_reflected=0xEDB88320;
    //=0xFFFFFFFF; //keep track of register value after each call
    static $reg=0xFFFFFFFF;
    //initialize register on first call
    if($first_call) $reg=0xFFFFFFFF;
    $n=strlen($str);
    $zeros=$n<4 ? $n : 4;
    //xor first $zeros=min(4,strlen($str)) bytes into the register
    for($i=0;$i<$zeros;$i++)
    $reg^=ord($str{$i})<<$i*8;
    //now for the rest of the string
    for($i=4;$i<$n;$i++){
    $next_char=ord($str{$i});
    for($j=0;$j<8;$j++)
    $reg=(($reg>>1&0x7FFFFFFF)|($next_char>>$j&1)<<0x1F)
    ^($reg&1)*$poly_reflected;
    //put in enough zeros at the end
    for($i=0;$i<$zeros*8;$i++)
    $reg=($reg>>1&0x7FFFFFFF)^($reg&1)*$poly_reflected;
    //xor the register with 0xFFFFFFFF
    return ~$reg;
    $str="123456789"; //whatever
    $blocksize=4; //whatever
    for($i=0;$i<strlen($str);$i+=$blocksize) $crc=bitbybit_crc32(substr($str,$i,$blocksize),!$i);
    ?>

    I am looking someone to help me w/o $.Go away.
    This reminds me of this one time. I had written this dice roller in PHP (still in use, actually) and someone who was using it thought it was nice and wanted a version of it for himself. Only he was running a different game system, some home brewn thing, so it had to be different in certain respects.
    First he just asked me if he could have the dice roller I wrote. I thought about it but eventually agreed. It wasn't much as code. Then he asked me to modify it for him, explaining that he could not do it himself. For some reason I was feeling generous that day, so I did not ask him for his physical address and send him a mail bomb. Instead I said that I would modify it for him if he explained what modifications he needed.
    Then he told me to go read his game system on his web site and figure it out for myself. I must have been in a saintly attitude that day because I actually went and looked at his site - which predictably, was totally disorganized and incomprehensible. I pointed this out and he told me that I would have to read through everything once or twice, and also, it wasn't done yet so I should check back periodically.
    This is a person who I had never met in my life, even online, and with whom my first contact was his request for my dice roller.
    Where do these people COME from?
    Drake

  • How to Convert From HEX to Java Unicode

    String hexString = "81698a94816a93fa97a790bb8dec8f8a814083478393835e815b83768389834383598354815b836f8e968bc69594814083568358836583808c9f8fd8835a8393835e";
    I have an hex string as shown above. Could please some one tell me how to convert to java unicode.

    Divide it into four-character pieces and for each piece to this:char c = (char)Integer.parseInt(thePiece, 16);That converts the four-character piece (e.g. "8a94") to the corresponding Unicode character (\u8a94). String those chars together into a char array or a String or whatever you need.

  • Converting from VB to java

    I am new to programming,writing my first java program. I want to write to the command line and have the command line (the system command line) execute. Can you tell me how?
    Balfour

    Balfour,
    When you say you want to 'write to the command line', what do you mean?
    If you run a Java program from the command line, e.g.java MyClassthen any output from that program to System.out or System.err will appear in the command prompt window.
    If, however, you have a program that needs to call and run a separate command prompt and/or Windows application then you need to look atRuntime.getRuntime().exec(someCommand)You can get more on this at http://java.sun.com/j2se/1.4/docs/api/java/lang/Runtime.html
    Hope this is useful.
    Chris.

  • Converting from Quicken to iBank - need info on importing files

    I am wanting to update my banking software and am running the OS 10.5.6 on a G4 but am about to convert to a new MacBook Pro with intel. I have been running an old copy of quicken for years and years through many Mac hardware upgrades 2002 and want to convert to using iBank. I worry that my Quicken 2002 may not run on the new intel computer. Actually, I'm amazed I've been able to use it for so long. If I buy iBank, will I be able to import the files from such an old version of Quicken? All I've ever done with it is to keep my account records and registers from savings, checking, credit cards and CDs. Hope someone knows before I invest in the iBank program. I don't want to go as complex as the new Quicken and besides, it's not out yet. Also, I'd like to stay with as many mac programs as I can. I find I do better that way.

    Yes, iBank is a program for the Mac OS, but it is not made by Apple. These discussions are for technical support for Apple products, hardware & software. Apple may have third-party hardware & software for sale in both the online & retail Apple Stores, but that does not mean they provide support for them. There is a disclaimer at the bottom of the online Apple Store pages like this one I copied from the page for iBank that says:
    Note: Products sold through this website that do not bear the Apple Brand name are serviced and supported exclusively by their manufacturers in accordance with terms and conditions packaged with the products. Apple's Limited Warranty does not apply to products that are not Apple-branded, even if packaged or sold with Apple products. Please contact the manufacturer directly for technical support and customer service.

  • Cannot convert from java.util.Date to java.sql.Date

    In the below code am trying to get the current date and 60 days prior date:
    Date  todayDate;
              Date  Sixtydaysprior;
              String DATE_FORMAT = "MM/dd/yy";
              DateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
             Calendar cal = Calendar.getInstance();
              todayDate = sdf.parse(sdf.format(cal.getTime()));
              cal.add(Calendar.DATE, -60);
             Sixtydaysprior = sdf.parse(sdf.format(cal.getTime()));I have imported following files:
    <%@page
         import="java.util.Calendar,
                   java.text.SimpleDateFormat,
                   java.text.ParseException,
                            java.util.*"
    %>Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    Thanks.
    Edited by: MiltonDetroja on May 22, 2009 11:03 AM

    Shows up following error msg:
    Type mismatch: cannot convert from java.util.Date to java.sql.Date
    I don't think this exception is thrown from the portion of code you have shown. As clearly specified in exception message, you cannot cast an instance of java.util.Date to java.sql.Date. you will need to do something like this
    java.util.Date today = new java.util.Date();
    long t = today.getTime();
    java.sql.Date dt = new java.sql.Date(t);

  • Convert from java file to cap file

    Dear Pro,
    Please help me this problem,
    I'm building a applet in eclipse. Now, I want to convert from java file to cap file to load it into javacard.
    I need repair what tools and do what, please help me!
    Thanks & Best Regards,
    KeillyNguyen

    Run -> Run Configuration -> Double click Java Card Application -> Click Run
    After that, the CAP file will be generated in the bin directory.
    Are you come from VN? Im Vietnamese :) Nice to meet you

  • Mediator To Spring Error-Could not convert from java interface to interface

    Hi,
    I have a requirement to using a Spring component and my composite application would be File Read -> Mediator -> Spring Component -> File Write.
    I have to read a file and using mediator map the same to the Spring input and write the Spring component output to a file.
    I have created a Java interface ( Package Name - transformtospring , Interface Name - TransformInterface) and also created a Java Class ( TransformImpl ) which implements the Interface in this package. Saved all these artifacts in SCA-INF/src folder of the application.
    My Spring Bean configuration file is as follows ( saved the file in the same folder as composite.xml )
    <?xml version="1.0" encoding="windows-1252" ?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:lang="http://www.springframework.org/schema/lang"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:sca="http://xmlns.oracle.com/weblogic/weblogic-sca"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://xmlns.oracle.com/weblogic/weblogic-sca META-INF/weblogic-sca.xsd">
    <!--Spring Bean definitions go here-->
    <bean class="transformtospring.TransformImpl" name="TransformBean"/>
    <sca:service name="TransformService" target="TransformBean"
    type="transformtospring.TransformImpl"/>
    </beans>
    I have created a Spring Context which uses the above Spring Configuration. When i tried to map the mediator output to Spring , i'm getting an error shown below.
    " Could not convert from java interface to interface type wsdl . Exception=java.lang.ClassNotFoundException transformtospring.TransformImpl "
    Please do let me know where exactly i'm doing wrong.
    Regards,
    Sri.

    Hi All,
    I could able to work this one out now !!!
    But i'm having an issue mapping the input to this service. The method signature for the service is as follows:
    public byte[] processData(byte[] input) throws Throwable{
    So the input for this Service is a byte array. Now i'm mapping the data from a File Input ( Read File - opaqueElement ) to this service directly ( using mediator ).
    Now when i have looked into the message in the Enterprise Manager, following is the message structure from Read File input to the service.
    <message>
    <properties>
    <property name="tracking.compositeInstanceId" value="10009"/>
    <property name="tracking.ecid" value="bcd04297e25136e7:4869a9c:13316255efc:-8000-0000000000001f79"/>
    <property name="tracking.conversationId" value="TJ9PCcbtu3S0DA0GuxsGx13RYUb1NxHNndfk2PC8ukk."/>
    </properties>
    <parts>
    <part name="parameters">
    <ns0:processCollaboration>
    <arg0>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48bnMwOkFkZDJJbnB1dCAgeG1s bnM6eHNpPSdodHRwOi8vd3d3LnczLm9yZy8yMDAxL1hNTFNjaGVtYS1pbnN0YW5jZScgeG1sbnM6 bnMwPSd1ay5jby5qZHdpbGxpYW1zLkFkZDJJbnB1dCcgeHNpOnNjaGVtYUxvY2F0aW9uPSd1ay5j by5qZHdpbGxpYW1zLkFkZDJJbnB1dCByZXF1ZXN0LnhzZCcPG5zMDpudW0xPjEwPC9uczA6bnVt MT48bnMwOm51bTI+MTY8L25zMDpudW0yPjwvbnMwOkFkZDJJbnB1dD4=+</arg0>
    </ns0:processCollaboration>
    </part>
    </parts>
    </message>
    and the corresponding response message ( No output ) back from the service is:
    <message>
    <properties>
    <property name="tracking.compositeInstanceId" value="10009"/>
    <property name="tracking.ecid" value="bcd04297e25136e7:4869a9c:13316255efc:-8000-0000000000001f79"/>
    <property name="componentName" value="ProcessCollab"/>
    <property name="tracking.conversationId" value="TJ9PCcbtu3S0DA0GuxsGx13RYUb1NxHNndfk2PC8ukk."/>
    <property name="compositeDN" value="default/CollaborationToSpring!1.0*soa_a8da1da7-f98f-4935-8d20-da9e7bc003cc"/>
    </properties>
    <parts>
    <part name="parameters">
    <processCollaborationResponse>
    <return/>
    </processCollaborationResponse>
    </part>
    </parts>
    </message>
    I have included System.out statements in my Java class , but its not printing anything in the logs.
    I'm under the impression that the underlying infrastructure ( mediator ) transparently encodes and decodes data from base64Binary to java byte array. So could anyone help me on this !!!
    Regards,
    Sri.

  • How to convert from UNICODE (UTF16) to UTF8 and vice-versa in JAVA.

    Hi
    I want to insert a string in format UTF16 to the database. How do I convert from UTF16 to UTF8 and vice- versa in JAVA?. What type must the database field be? Do I need a special set up for the database (oracle 8.i)?
    thanks
    null

    I'm not sure if this is the correct topic, but we are having problems accessing our Japanese data stored in UTF-8 in our Oracle database using the JDBC thin driver. The data is submitted and extracted correctly using ODBC drivers, but inspection of the same data retrieved from the GetString() call using the JDBC thin driver shows frequent occurrences of bytes like "FF", which are not expected in either UTF8 or UCS2. My understanding is that accessing UTF8 in Java should involve NO NLS translation, since we are simply going from one Unicode encoding to another.
    We are using Oracle version 8.0.4.
    Can you tell me what we are doing wrong?
    null

  • How to convert from xml file to html using java code

    How to convert from xml file to html file using java code

    Get yourself Apache Xalan or Saxon or some XSLT processor
    String styleSheet = "/YourXSLTStylesheet.xsl";
    String dataSource = "/YourXMLDocument.xml";
    InputStream stylesheetSource = TransformMe.class.getResourceAsStream(styleSheet);
    InputStream dataSourceStream = TransformMe.class.getResourceAsStream(dataSource);
    OutputStream transformedOut = new FileOutputStream("filename.html");
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer transformer = tFactory.newTransformer(new StreamSource(stylesheetSource));
    transformer.transform(new StreamSource(dataSourceStream), new StreamResult(transformedOut));You'll also need to learn XSLT if you don't already know that. Here's a good place to start
    http://www.w3schools.com/xsl/

  • I was informed i need to purchase standard 11 or standard 12 (?) in order to make word files converted from pdf editable. how do i do this?

    i was informed i need to purchase standard 11 or standard 12 from adobe in order to make files converted from pdf to word using the recently bought and installed adobe pdf exporter file. how/where do i do this?

    Currently the Acrobat version is "XI" (no "12").
    With Acrobat XI installed:
    "File - Save As Other"  --- from here you pick the supported file format for the export.
    If a PDF has content that is the output of a scanner then that output (as is the case for All scanners' output) is a picture of text and not real text.
    During an export all that can be processed is the picture. As a picture of text is not text it is understandable why Word (or other word processors) cannot edit the content.
    So, for such, prior to export run Acrobat's OCR and save.
    The export will be of the OCR content.
    Do expect to do clean of the text, spelling, punctuation, layout etc.
    This may be minor. This may be major. But, there will be some.
    Adobe as some online subscription services that can take a "proper" PDF (NOT all are eh) and export to supported file formats.
    Two are "ExportPDF" and "PDF Pack".
    Be well...

  • How do I copy a few lines from a pdf document to a Word document?  I'm not looking to convert the whole document, just need to copy a few lines here and there.

    How do I copy a few lines from a pdf document to a Word document?
    I'm not looking to convert the whole document, just need to copy a few lines here and there.
    ps.  Wow, what a user UNFRIENDLY site this is!

    In most cases you can just select the text and copy/paste. You can do that unless the file is a picture/scan.

  • How do I convert from PDF to Word step by step instructions needed..am practically computer illiterate

    How do I convert from PDF to Word step by step instructions needed..am practically computer illiterate@

    Ok, fine. That isn't Acrobat, and that's why our instructions weren't much use. (But it's worth saying "I didn't have that option" rather than "it's not converting", we could end up wasting a lot of your time with the wrong stuff!)
    Anyway, the free Adobe Reader can't do this conversion without a subscription called either ExportPDF or PDF Pack. You may have had one in the past. Are you still paying for one?

  • I need to send a file that i have converted from pdf to word to my pc

    i need to send a file that i have converted from pdf to word to my pc

    Converted how?  If using ExportPDF, then you should be able to download it from acrobat.com by using your Adobe ID.

  • I paid for PDF to Word subscription through iTunes but when I try to convert from my computer directly from Adobe, it says I need a subscription.  Help?

    I paid for PDF to Word subscription through iTunes but when I try to convert from my computer directly from Adobe, it says I need a subscription.  Help?

    Hi divabuyer,
    It sounds like you're trying to convert to Word from within Reader, is that so? Are you signed in to Reader? If so, you'll see your name in the upper-right corner of the Reader application window.
    If that doesn't work, please try llogging in to https://cloud.acrobat.com/exportpdf with your Adobe ID and password.
    Let us know how it goes.
    Best,
    Sara

Maybe you are looking for

  • I am getting following error while activating trasfer rule

    hi all, "Field name DAY_ACTU_PROGRESS is too long (length > 16 characters)": Diagnosis Field names in the transfer structure can be a max of 16 characters long. Field name DAY_ACTU_PROGRESS in transfer structure ZPS_CDPR_HA has a length of 17. I have

  • Upgraded to new itunes, now it won't open

    I downloaded the new itunes and now when I click on it, nothing happens. Quicktime will open when I click on it, but it freezes up. And the Apple Software Update will open up, but it freezes up too. I uninstalled the new itunes and reinstalled my old

  • SAP Best Practice: Can't open process maps

    Hi Community, when I try to open a process map within the SAP best practice package I receive this error message (tried various browser, low security settings): Any ideas how to avoid this error message? Thanks in advance, Frank

  • How to download photoshop cs2

    how i can download photoshop cs2 trial version

  • HT5019 i do not have the arrangement tab in my display settings??

    i am trying to connect my 2011 macbook pro osx 10.6.8 to my sony hdtv and cannot get them to find each other. i have gone into display settings and do not seem to have the arrangement tab in bewteen display and colour. can anybody offer and help or a