Archive for April, 2008
Facts About Php Programming Language
john wircken asked:
PHP which is officially known as ‘Hypertext Preprocessor’ was released in the year 1995. Initially written as a set of Common Gateway Interface (CGI) in ‘C’, PHP was originally designed to replace a set of Perl scripts to maintain his Personal Home Pages (also known as PHP). PHP was originally designed to create dynamic and more interactive web pages. It is the most widely-used, open-source and general-purpose scripting language. It is a server-side scripting language often written in a HTML context. PHP code in a script can query databases, create images, read and write files and talk to remote servers. The output from PHP code is combined with HTML in script and the result is sent to the user.
It is possible to use PHP in almost every operating system. PHP can be used in all major operating systems including Linux, Microsoft Windows, Mac OS X, and RISC OS. PHP uses procedural programming or object oriented programming and also a mixture of them. PHP is used mainly in server-side scripting, command line interface and writing desktop applications. PHP also supports ODBC, the Open Database Connection standard which allows you to connect to other databases supporting this world standard. Server-side scripting is the most traditional one for PHP development. In order to use PHP for server-side scripting you need a PHP parser, a web server and a web browser. The PHP codes entered with the parser on a web server will be translated into a PHP page that can be viewed on your web browser.
PHP is a popular language because it can be embedded directly into HTML coding. It has more benefits such as the following - it can be used on all major operating systems and can be supported by most of the web servers. The latest version of PHP development is a very stable and grown-up language used for web programming like Java and Microsoft C#. Both the PHP engine and the PHP code can be used on any platform, which makes PHP extremely flexible.
PHP has many features designed specifically for use in websites. PHP can be used to make your website secure by implementing mandatory sign in feature – asking the user or the administrator to enter a valid username and password. Adding such a feature is easy as PHP can display a HTML form and process the information that the user types in. This ‘sign in’ feature can be an excellent way of getting to know about your customer’s profile.
The popularity of PHP Development continues to grow rapidly because it has many advantages. PHP is fast because the time needed to process and load a webpage is relatively low. PHP is also versatile and it runs on a wide variety of operating systems. PHP hosting is a server-side scripting environment that is used to create dynamic web pages. It is an open source language which is widely used by programmers and web developers. Open source gives a lot of advantages over proprietary programming languages. Due to this reason, PHP has been the one of the most popular server-side scripting language so far. Almost all the hosting providers offer PHP hosting services these days. PHP is especially strong in relational databases, which are used for dynamic content and e-commerce applications.
Scott
PHP which is officially known as ‘Hypertext Preprocessor’ was released in the year 1995. Initially written as a set of Common Gateway Interface (CGI) in ‘C’, PHP was originally designed to replace a set of Perl scripts to maintain his Personal Home Pages (also known as PHP). PHP was originally designed to create dynamic and more interactive web pages. It is the most widely-used, open-source and general-purpose scripting language. It is a server-side scripting language often written in a HTML context. PHP code in a script can query databases, create images, read and write files and talk to remote servers. The output from PHP code is combined with HTML in script and the result is sent to the user.
It is possible to use PHP in almost every operating system. PHP can be used in all major operating systems including Linux, Microsoft Windows, Mac OS X, and RISC OS. PHP uses procedural programming or object oriented programming and also a mixture of them. PHP is used mainly in server-side scripting, command line interface and writing desktop applications. PHP also supports ODBC, the Open Database Connection standard which allows you to connect to other databases supporting this world standard. Server-side scripting is the most traditional one for PHP development. In order to use PHP for server-side scripting you need a PHP parser, a web server and a web browser. The PHP codes entered with the parser on a web server will be translated into a PHP page that can be viewed on your web browser.
PHP is a popular language because it can be embedded directly into HTML coding. It has more benefits such as the following - it can be used on all major operating systems and can be supported by most of the web servers. The latest version of PHP development is a very stable and grown-up language used for web programming like Java and Microsoft C#. Both the PHP engine and the PHP code can be used on any platform, which makes PHP extremely flexible.
PHP has many features designed specifically for use in websites. PHP can be used to make your website secure by implementing mandatory sign in feature – asking the user or the administrator to enter a valid username and password. Adding such a feature is easy as PHP can display a HTML form and process the information that the user types in. This ‘sign in’ feature can be an excellent way of getting to know about your customer’s profile.
The popularity of PHP Development continues to grow rapidly because it has many advantages. PHP is fast because the time needed to process and load a webpage is relatively low. PHP is also versatile and it runs on a wide variety of operating systems. PHP hosting is a server-side scripting environment that is used to create dynamic web pages. It is an open source language which is widely used by programmers and web developers. Open source gives a lot of advantages over proprietary programming languages. Due to this reason, PHP has been the one of the most popular server-side scripting language so far. Almost all the hosting providers offer PHP hosting services these days. PHP is especially strong in relational databases, which are used for dynamic content and e-commerce applications.
Scott
Asymmetric Cryptography in Java
Debadatta Mishra asked:
Security plays a significant role in our day to day life. So far software applications are concerned, security of data is required for authentication and for several validations. Normally while developing the applications, we use the concept of cryptography for password encryption and decryption. Some applications require more security, so they go for high end security system like trusted security certificates. The security mainly focuses on the integrity of the data at the several ends.
Technicalities For data security Java Cryptography provides a suitable framework to implement several kinds of cryptography. However there are basically two types of cryptography. Once is Symmetric Cryptography and Asymmetric Cryptography. When both the ends communicate the secured data with a common key for encryption and decryption, it is called the Symmetric Cryptography. In this case a shared key is used by both the parties to encrypt and decrypt the data. However there is a problem relating to exchange of key for symmetric cryptography. To overcome this problem java provides another approach for the cryptography called Asymmetric Cryptography. In case of Asymmetric cryptography, there will be two keys unlike one key in case of symmetric cryptography. One key is called Private key and other is called Public key. These two keys are generated together and can be used for encryption and decryption. In this case the Public key is used by anyone who wishes to communicate securely with the owner of the Private key. The Private key is used by the main owner and the owner gives the Public key so that they can decrypt the data. In this article I will give you the example on Asymmetric cryptography. You can find more tutorials and concept on Sun’s JCE(Java Cryptography Extension). In my next article, I will provide you the example on Symmetric cryptography.
Complete Example This example is only meant for learning and not for any specific use. You can take the piece of code to test in your system to learn the above concept.
The following class is used to create the Public key and Private key. This class contains generic methods to generate the Public and Private key. If you run the testharness class, you will find the two files called “Public.key” and “Private.key”. Please go through the java docs mentioned in the methods.
Class Name : - KeyCreator.java
package com.dds.security;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
/**This class is used to generate the Private and Public key file.
* The Public.key file and Private.key file will be generated in the
* current directory.
* @author Debadatta Mishra(PIKU)
*
*/
public class KeyCreator
{
/**
* Object of type {@link PublicKey}
*/
private PublicKey publicKey = null;
/**
* Object of type {@link PrivateKey}
*/
private PrivateKey privateKey = null;
/**Default constructor.
* Here KeyPair object is initialized and
* thereby public key and private key objects
* are created.
* @throws Exception
*/
public KeyCreator() throws Exception
{
super();
/*
* The following line is used to
* generate the Public and Private
* key.
*/
KeyPair keyPair = KeyPairGenerator
.getInstance(”RSA”)
.generateKeyPair();
publicKey = keyPair.getPublic();
privateKey = keyPair.getPrivate();
}
/**Method to return the {@link PublicKey}
* @return the {@link PublicKey}
*/
public PublicKey getPublicKey() {
return publicKey;
}
/**Method to return the {@link PrivateKey}
* @return the {@link PrivateKey}
*/
public PrivateKey getPrivateKey() {
return privateKey;
}
/**Method used to write the Public or Private
* key file.
* @param filename of type String indicating
* the name of Public or Private key
* @param contents of the key
*/
public void writeKey(String filename, byte[] contents)
{
try
{
FileOutputStream fos = new FileOutputStream(filename);
fos.write(contents);
fos.flush();
fos.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
The following class is used to read the “Public.key” and “Private.key” generated by the above program. If you are the owner you can have the “Private.key” file based upon which you have to encrypt the data and give your “Public.key” file to other end who wants to decrypt the data. In this following class, you can read both the “Public.key” and “Private.key” files.
Class Name:- KeyReader.java
package com.dds.security;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* This class is used to read the Private and Public key
* files generated using the Java’s Asysmmetric Security
* system.
* @author Debadatta Mishra(PIKU)
*
*/
public class KeyReader
{
/**
* Object of type {@link KeyFactory}
*/
private KeyFactory keyFactory = null;
/**
* Default constructor to initialize the
* keyFactory.
*/
public KeyReader()
{
super();
try
{
keyFactory = KeyFactory.getInstance(”RSA”);
}
catch( Exception e )
{
e.printStackTrace();
}
}
/**This method is used to read the bytes from the file.
* The file can be a Public key file or a Private key
* file. In this file, you have stored the security key,
* based upon which encryption and decryption can be
* performed.
* @param fileName of type String indicating the file name
* @return the bytes from the file
* @throws Exception
*/
private byte[] getKeyData( String fileName ) throws Exception
{
FileInputStream fis = new FileInputStream(fileName);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int b;
try
{
while ((b = fis.read()) != -1)
{
baos.write(b);
}
fis.close();
baos.flush();
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
return baos.toByteArray();
}
/**This method is used to return the object of type
* {@link PrivateKey}. In this method you have to pass
* the file name of the Private.key file.
* @param filename of type String indicating the
* file name.
* @return the object of type {@link PrivateKey}
* @throws Exception
*/
public PrivateKey getPrivateKey( String filename ) throws Exception
{
PrivateKey privateKey = null;
try
{
byte[] keydata = getKeyData(filename);
PKCS8EncodedKeySpec encodedPrivateKey = new PKCS8EncodedKeySpec(keydata);
privateKey = keyFactory.generatePrivate(encodedPrivateKey);
}
catch( Exception e )
{
e.printStackTrace();
}
return privateKey;
}
/**This method is used to return the object of type
* {@link PublicKey}. In this method you have to pass
* the file name of the Public.key file.
* @param filename of type String indicating the
* file name.
* @return the object of type {@link PublicKey}
* @throws Exception
*/
public PublicKey getPublicKey( String filename ) throws Exception
{
PublicKey publicKey = null;
try
{
byte[] keydata = getKeyData(filename);
X509EncodedKeySpec encodedPublicKey = new X509EncodedKeySpec(keydata);
publicKey = keyFactory.generatePublic(encodedPublicKey);
}
catch( Exception e )
{
e.printStackTrace();
}
return publicKey;
}
}
The following class is a utility class which is used to encrypt and decrypt the data.
ClassName :- SecurityUtil.java
package com.dds.security;
import java.security.PrivateKey;
import java.security.PublicKey;
import javax.crypto.Cipher;
/**This is a utility class to provide
* encryption and decryption based upon
* the key. The key can be your either
* Public or Private .
* @author Debadatta Mishra(PIKU)
*
*/
public class SecurityUtil
{
/**
* Object of type {@link Cipher}
*/
private static Cipher cipher = null;
/*
* The following static is used to
* initialize the Cipher object
*/
static
{
try
{
cipher = Cipher.getInstance(”RSA”);
}
catch( Exception e )
{
e.printStackTrace();
}
}
/**Method used to encrypt the string and return as bytes.
* Here the input parameter will be your Private key.
* You have to encrypt the string using your private
* key at your end.
* @param messsageBytes , it is the bytes from the
* string to encrypt
* @param privateKey of type {@link PrivateKey}
* @return encrypted bytes
* @throws Exception
*/
public static byte[] getEncryptedBytes( byte[] messsageBytes , PrivateKey privateKey) throws Exception
{
byte[] encryptedBytes = null;
cipher.init(Cipher.ENCRYPT_MODE , privateKey );
encryptedBytes = cipher.doFinal(messsageBytes);
return encryptedBytes;
}
/**Method used to decrypt the string and return as bytes.
* Here the input parameter will be your Public key.
* You have to decrypt the string using your Public
* key at the destination end.
* @param messsageBytes , it is the bytes from the
* string to encrypt
* @param publicKey of type {@link PublicKey}
* @return decrypted bytes
* @throws Exception
*/
public static byte[] getDecryptedBytes( byte[] messsageBytes , PublicKey publicKey)throws Exception
{
byte[] decryptedBytes = null;
cipher.init(Cipher.DECRYPT_MODE , publicKey );
decryptedBytes = cipher.doFinal( messsageBytes );
return decryptedBytes;
}
}
The following is test harness class to test the functionality of the above program. Please go through the comments and java docs of the above and below programs.
Class Name :- SecurityTestHarness.java
package com.security.testharness;
import java.security.PrivateKey;
import java.security.PublicKey;
import com.dds.security.KeyCreator;
import com.dds.security.KeyReader;
import com.dds.security.SecurityUtil;
/**This is a test harness class used to
* encrypt and decrypt the string based
* upon the Public and Private key.
* This class also helps to test how
* Public and Private key can be created.
* @author Debadatta Mishra(PIKU)
*
*/
public class SecurityTestHarness
{
public static void main(String[] args)
{
try
{
/*
* The following lines will generate the
* PublicKey and PrivateKey files.
*/
KeyCreator keyCreator = new KeyCreator();
PublicKey publicKey = keyCreator.getPublicKey();
PrivateKey privateKey = keyCreator.getPrivateKey();
/*
* Generate two files named Public.key and Private.key
*/
keyCreator.writeKey(”Public.key”, publicKey.getEncoded());
keyCreator.writeKey(”Private.key”, privateKey.getEncoded());
/*
* Get the public and private key
*/
KeyReader keyReader = new KeyReader();
PublicKey publicKey2 = keyReader.getPublicKey(”Public.key”);
System.out.println(”Public Key—-”+publicKey2);
PrivateKey privateKey2 = keyReader.getPrivateKey(”Private.key”);
System.out.println(”Private Key—-”+privateKey2);
String str = “Hi, Hello World, Welcome to the World of Java”;
byte[] stringBytes = str.getBytes();
byte[] encryptedBytes = SecurityUtil.getEncryptedBytes(
stringBytes, privateKey2);
String encryptedString = new String(encryptedBytes);
System.out.println(”EncryptedString—-”+encryptedString);
byte[] decryptedBytes = SecurityUtil.getDecryptedBytes(encryptedBytes, publicKey2);
System.out.println(”Decrypted String—-”+new String(decryptedBytes));
}
catch( Exception e )
{
e.printStackTrace();
}
}
}
To test the above programs, please create the appropriate package as mentioned in the program. You can also create your own package and modify the package name in the above programs. You can all the code in your favorable java editor.
Conclusion I hope that you will enjoy my article. If you find any problems or errors, please feel free to send me a mail in the address debadattamishra@aol.com . This article is only meant for those who are new to java development. This article does not bear any commercial significance. Please provide me the feedback about this article.
Stanley
Security plays a significant role in our day to day life. So far software applications are concerned, security of data is required for authentication and for several validations. Normally while developing the applications, we use the concept of cryptography for password encryption and decryption. Some applications require more security, so they go for high end security system like trusted security certificates. The security mainly focuses on the integrity of the data at the several ends.
Technicalities For data security Java Cryptography provides a suitable framework to implement several kinds of cryptography. However there are basically two types of cryptography. Once is Symmetric Cryptography and Asymmetric Cryptography. When both the ends communicate the secured data with a common key for encryption and decryption, it is called the Symmetric Cryptography. In this case a shared key is used by both the parties to encrypt and decrypt the data. However there is a problem relating to exchange of key for symmetric cryptography. To overcome this problem java provides another approach for the cryptography called Asymmetric Cryptography. In case of Asymmetric cryptography, there will be two keys unlike one key in case of symmetric cryptography. One key is called Private key and other is called Public key. These two keys are generated together and can be used for encryption and decryption. In this case the Public key is used by anyone who wishes to communicate securely with the owner of the Private key. The Private key is used by the main owner and the owner gives the Public key so that they can decrypt the data. In this article I will give you the example on Asymmetric cryptography. You can find more tutorials and concept on Sun’s JCE(Java Cryptography Extension). In my next article, I will provide you the example on Symmetric cryptography.
Complete Example This example is only meant for learning and not for any specific use. You can take the piece of code to test in your system to learn the above concept.
The following class is used to create the Public key and Private key. This class contains generic methods to generate the Public and Private key. If you run the testharness class, you will find the two files called “Public.key” and “Private.key”. Please go through the java docs mentioned in the methods.
Class Name : - KeyCreator.java
package com.dds.security;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
/**This class is used to generate the Private and Public key file.
* The Public.key file and Private.key file will be generated in the
* current directory.
* @author Debadatta Mishra(PIKU)
*
*/
public class KeyCreator
{
/**
* Object of type {@link PublicKey}
*/
private PublicKey publicKey = null;
/**
* Object of type {@link PrivateKey}
*/
private PrivateKey privateKey = null;
/**Default constructor.
* Here KeyPair object is initialized and
* thereby public key and private key objects
* are created.
* @throws Exception
*/
public KeyCreator() throws Exception
{
super();
/*
* The following line is used to
* generate the Public and Private
* key.
*/
KeyPair keyPair = KeyPairGenerator
.getInstance(”RSA”)
.generateKeyPair();
publicKey = keyPair.getPublic();
privateKey = keyPair.getPrivate();
}
/**Method to return the {@link PublicKey}
* @return the {@link PublicKey}
*/
public PublicKey getPublicKey() {
return publicKey;
}
/**Method to return the {@link PrivateKey}
* @return the {@link PrivateKey}
*/
public PrivateKey getPrivateKey() {
return privateKey;
}
/**Method used to write the Public or Private
* key file.
* @param filename of type String indicating
* the name of Public or Private key
* @param contents of the key
*/
public void writeKey(String filename, byte[] contents)
{
try
{
FileOutputStream fos = new FileOutputStream(filename);
fos.write(contents);
fos.flush();
fos.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
The following class is used to read the “Public.key” and “Private.key” generated by the above program. If you are the owner you can have the “Private.key” file based upon which you have to encrypt the data and give your “Public.key” file to other end who wants to decrypt the data. In this following class, you can read both the “Public.key” and “Private.key” files.
Class Name:- KeyReader.java
package com.dds.security;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
/**
* This class is used to read the Private and Public key
* files generated using the Java’s Asysmmetric Security
* system.
* @author Debadatta Mishra(PIKU)
*
*/
public class KeyReader
{
/**
* Object of type {@link KeyFactory}
*/
private KeyFactory keyFactory = null;
/**
* Default constructor to initialize the
* keyFactory.
*/
public KeyReader()
{
super();
try
{
keyFactory = KeyFactory.getInstance(”RSA”);
}
catch( Exception e )
{
e.printStackTrace();
}
}
/**This method is used to read the bytes from the file.
* The file can be a Public key file or a Private key
* file. In this file, you have stored the security key,
* based upon which encryption and decryption can be
* performed.
* @param fileName of type String indicating the file name
* @return the bytes from the file
* @throws Exception
*/
private byte[] getKeyData( String fileName ) throws Exception
{
FileInputStream fis = new FileInputStream(fileName);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int b;
try
{
while ((b = fis.read()) != -1)
{
baos.write(b);
}
fis.close();
baos.flush();
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
return baos.toByteArray();
}
/**This method is used to return the object of type
* {@link PrivateKey}. In this method you have to pass
* the file name of the Private.key file.
* @param filename of type String indicating the
* file name.
* @return the object of type {@link PrivateKey}
* @throws Exception
*/
public PrivateKey getPrivateKey( String filename ) throws Exception
{
PrivateKey privateKey = null;
try
{
byte[] keydata = getKeyData(filename);
PKCS8EncodedKeySpec encodedPrivateKey = new PKCS8EncodedKeySpec(keydata);
privateKey = keyFactory.generatePrivate(encodedPrivateKey);
}
catch( Exception e )
{
e.printStackTrace();
}
return privateKey;
}
/**This method is used to return the object of type
* {@link PublicKey}. In this method you have to pass
* the file name of the Public.key file.
* @param filename of type String indicating the
* file name.
* @return the object of type {@link PublicKey}
* @throws Exception
*/
public PublicKey getPublicKey( String filename ) throws Exception
{
PublicKey publicKey = null;
try
{
byte[] keydata = getKeyData(filename);
X509EncodedKeySpec encodedPublicKey = new X509EncodedKeySpec(keydata);
publicKey = keyFactory.generatePublic(encodedPublicKey);
}
catch( Exception e )
{
e.printStackTrace();
}
return publicKey;
}
}
The following class is a utility class which is used to encrypt and decrypt the data.
ClassName :- SecurityUtil.java
package com.dds.security;
import java.security.PrivateKey;
import java.security.PublicKey;
import javax.crypto.Cipher;
/**This is a utility class to provide
* encryption and decryption based upon
* the key. The key can be your either
* Public or Private .
* @author Debadatta Mishra(PIKU)
*
*/
public class SecurityUtil
{
/**
* Object of type {@link Cipher}
*/
private static Cipher cipher = null;
/*
* The following static is used to
* initialize the Cipher object
*/
static
{
try
{
cipher = Cipher.getInstance(”RSA”);
}
catch( Exception e )
{
e.printStackTrace();
}
}
/**Method used to encrypt the string and return as bytes.
* Here the input parameter will be your Private key.
* You have to encrypt the string using your private
* key at your end.
* @param messsageBytes , it is the bytes from the
* string to encrypt
* @param privateKey of type {@link PrivateKey}
* @return encrypted bytes
* @throws Exception
*/
public static byte[] getEncryptedBytes( byte[] messsageBytes , PrivateKey privateKey) throws Exception
{
byte[] encryptedBytes = null;
cipher.init(Cipher.ENCRYPT_MODE , privateKey );
encryptedBytes = cipher.doFinal(messsageBytes);
return encryptedBytes;
}
/**Method used to decrypt the string and return as bytes.
* Here the input parameter will be your Public key.
* You have to decrypt the string using your Public
* key at the destination end.
* @param messsageBytes , it is the bytes from the
* string to encrypt
* @param publicKey of type {@link PublicKey}
* @return decrypted bytes
* @throws Exception
*/
public static byte[] getDecryptedBytes( byte[] messsageBytes , PublicKey publicKey)throws Exception
{
byte[] decryptedBytes = null;
cipher.init(Cipher.DECRYPT_MODE , publicKey );
decryptedBytes = cipher.doFinal( messsageBytes );
return decryptedBytes;
}
}
The following is test harness class to test the functionality of the above program. Please go through the comments and java docs of the above and below programs.
Class Name :- SecurityTestHarness.java
package com.security.testharness;
import java.security.PrivateKey;
import java.security.PublicKey;
import com.dds.security.KeyCreator;
import com.dds.security.KeyReader;
import com.dds.security.SecurityUtil;
/**This is a test harness class used to
* encrypt and decrypt the string based
* upon the Public and Private key.
* This class also helps to test how
* Public and Private key can be created.
* @author Debadatta Mishra(PIKU)
*
*/
public class SecurityTestHarness
{
public static void main(String[] args)
{
try
{
/*
* The following lines will generate the
* PublicKey and PrivateKey files.
*/
KeyCreator keyCreator = new KeyCreator();
PublicKey publicKey = keyCreator.getPublicKey();
PrivateKey privateKey = keyCreator.getPrivateKey();
/*
* Generate two files named Public.key and Private.key
*/
keyCreator.writeKey(”Public.key”, publicKey.getEncoded());
keyCreator.writeKey(”Private.key”, privateKey.getEncoded());
/*
* Get the public and private key
*/
KeyReader keyReader = new KeyReader();
PublicKey publicKey2 = keyReader.getPublicKey(”Public.key”);
System.out.println(”Public Key—-”+publicKey2);
PrivateKey privateKey2 = keyReader.getPrivateKey(”Private.key”);
System.out.println(”Private Key—-”+privateKey2);
String str = “Hi, Hello World, Welcome to the World of Java”;
byte[] stringBytes = str.getBytes();
byte[] encryptedBytes = SecurityUtil.getEncryptedBytes(
stringBytes, privateKey2);
String encryptedString = new String(encryptedBytes);
System.out.println(”EncryptedString—-”+encryptedString);
byte[] decryptedBytes = SecurityUtil.getDecryptedBytes(encryptedBytes, publicKey2);
System.out.println(”Decrypted String—-”+new String(decryptedBytes));
}
catch( Exception e )
{
e.printStackTrace();
}
}
}
To test the above programs, please create the appropriate package as mentioned in the program. You can also create your own package and modify the package name in the above programs. You can all the code in your favorable java editor.
Conclusion I hope that you will enjoy my article. If you find any problems or errors, please feel free to send me a mail in the address debadattamishra@aol.com . This article is only meant for those who are new to java development. This article does not bear any commercial significance. Please provide me the feedback about this article.
Stanley
Php: Hypertext Preprocessor
Santanu Boral asked:
PHP is generally a scripting language, which is suited for web development. It can be embedded into HTML. If you want to know about PHP, you have to check out the online manual.
PHP 5.2.5 is announced by the PHP development team. In fact all PHP users are encouraged to upgrade to this release. The people, who are attached with the development, are very pleased to announce the initial released of the new system, which is generated the PHP manuals. Everyone encourages testing and using this system.
Except additional changes to the PHP manual, this new build system is stable. Basically, in this PHP manual is improved navigated system and styling for OOP documentation. For further details about PHP 5.2.4 is released can be found in the released announcement for the current version of PHP. From today, the three years ago, the PHP 5.0 was released. Till last three years, there has been seen many improvements over PHP 4.0, although PHP 5.0 is fast, stable and production-ready. As we all know PHP 6 is on the way, and PHP 4 will be discontinued.
The PHP development team hereby announces that support for PHP 4.0, which will be continued until the end of the year only. In fact after December, 2007 there will be no more release of PHP 4.4. So the rest of the days of this year, always you have to make your application suitable for PHP 5, and for that purpose you have to follow the PHP migration guide.
Edna
PHP is generally a scripting language, which is suited for web development. It can be embedded into HTML. If you want to know about PHP, you have to check out the online manual.
PHP 5.2.5 is announced by the PHP development team. In fact all PHP users are encouraged to upgrade to this release. The people, who are attached with the development, are very pleased to announce the initial released of the new system, which is generated the PHP manuals. Everyone encourages testing and using this system.
Except additional changes to the PHP manual, this new build system is stable. Basically, in this PHP manual is improved navigated system and styling for OOP documentation. For further details about PHP 5.2.4 is released can be found in the released announcement for the current version of PHP. From today, the three years ago, the PHP 5.0 was released. Till last three years, there has been seen many improvements over PHP 4.0, although PHP 5.0 is fast, stable and production-ready. As we all know PHP 6 is on the way, and PHP 4 will be discontinued.
The PHP development team hereby announces that support for PHP 4.0, which will be continued until the end of the year only. In fact after December, 2007 there will be no more release of PHP 4.4. So the rest of the days of this year, always you have to make your application suitable for PHP 5, and for that purpose you have to follow the PHP migration guide.
Edna
One of the Most Advantageous Scripting Language - Php
Rightway Solution asked:
PHP or HyperText Preprocessor is a server side scripting language used for creating dynamic websites. The script which is initially possessed by the server is then transferred to buyer via HTML files. The language is even used for command-line scripting and client-side GUI applications. More importantly, the back-end tool for PHP is My SQL, the interfacing property of My SQL, an online database, which matches with PHP. So webmasters, who want to make their web sites automated, can zero in on My SQL and PHP, to build dynamic websites.
Now coming to the point, the developers at Rightway Solution have acquired the required skills to deliver high-end PHP Solutions to its clients world-wide. The advantages of PHP are enumerated below:
Benefits of PHP
• PHP has been breaking new ground in the outsourcing world, with over 1,000,000 websites currently lapping up the benefits PHP language. Shaking off traditional static image of the websites, the language apparently endows the site with certain level of vibrancy.
• PHP’s written scripts are pretty instrumental in keeping track of the visitor’s activities on your site. Sending out emails to the subscribers, aiding users upload files or images to the site, and driving content on your site dynamically, using databases.
• Small business sites, can utilize PHP to obtain feed back from users on their products and services. The script even aids in creating a form which will allow customers in sending emails to you directly.
• Being a free open source language, the users need not shell out thousands of dollars in licensing fee to acquire PHP. Cost-savings has made PHP the much preferred language over competitors like Microsoft’s ASP.NET and Visual Basic.net and Sun Microsystems’ Java.
• Easy in installation. Moreover, PHP Programs have their base in C & C++ and finds similarity with C++ and C syntax and so it is even easy to learn.
• PHP does not put a load on servers. The code is optimized to make the server’s job easier.
• As much of the processing is moved to the server, collection and use of data becomes more convenient with PHP. Data can be easily stored in databases and used in new ways. Users have access to this centralized data. Web sites can be created by making use of the central reserve much more efficiently.
• PHP gives developers much more freedom to create light, feature rich web sites that reuse common elements while still being connected to extended data sources.
• One of PHP’s primary benefits is a lack of dependence on external programs to run the code. Media files like sound, video and flash require plug-ins to function. Some browsers have the necessary plug-ins pre-installed, but many of the browsers need to download the necessary software to view components of websites. PHP is executed exclusively by the server and therefore requires nothing from the end-user.
PHP Development
Florence
PHP or HyperText Preprocessor is a server side scripting language used for creating dynamic websites. The script which is initially possessed by the server is then transferred to buyer via HTML files. The language is even used for command-line scripting and client-side GUI applications. More importantly, the back-end tool for PHP is My SQL, the interfacing property of My SQL, an online database, which matches with PHP. So webmasters, who want to make their web sites automated, can zero in on My SQL and PHP, to build dynamic websites.
Now coming to the point, the developers at Rightway Solution have acquired the required skills to deliver high-end PHP Solutions to its clients world-wide. The advantages of PHP are enumerated below:
Benefits of PHP
• PHP has been breaking new ground in the outsourcing world, with over 1,000,000 websites currently lapping up the benefits PHP language. Shaking off traditional static image of the websites, the language apparently endows the site with certain level of vibrancy.
• PHP’s written scripts are pretty instrumental in keeping track of the visitor’s activities on your site. Sending out emails to the subscribers, aiding users upload files or images to the site, and driving content on your site dynamically, using databases.
• Small business sites, can utilize PHP to obtain feed back from users on their products and services. The script even aids in creating a form which will allow customers in sending emails to you directly.
• Being a free open source language, the users need not shell out thousands of dollars in licensing fee to acquire PHP. Cost-savings has made PHP the much preferred language over competitors like Microsoft’s ASP.NET and Visual Basic.net and Sun Microsystems’ Java.
• Easy in installation. Moreover, PHP Programs have their base in C & C++ and finds similarity with C++ and C syntax and so it is even easy to learn.
• PHP does not put a load on servers. The code is optimized to make the server’s job easier.
• As much of the processing is moved to the server, collection and use of data becomes more convenient with PHP. Data can be easily stored in databases and used in new ways. Users have access to this centralized data. Web sites can be created by making use of the central reserve much more efficiently.
• PHP gives developers much more freedom to create light, feature rich web sites that reuse common elements while still being connected to extended data sources.
• One of PHP’s primary benefits is a lack of dependence on external programs to run the code. Media files like sound, video and flash require plug-ins to function. Some browsers have the necessary plug-ins pre-installed, but many of the browsers need to download the necessary software to view components of websites. PHP is executed exclusively by the server and therefore requires nothing from the end-user.
PHP Development
Florence
On Demand Applications: Enterprise Java Bean Application Development With a Three-tier Architecture
vivek asked:
Any mention of enterprise java bean application development would be incomplete without gaining an understanding of what a java session bean actually is. Java session beans are actually java components that run in either stand –alone EJB containers or EJB containers that are part of the standard java platform enterprise edition application servers. These java beans are typically used to model a particular task or use case such as input of customer information or executing a process that maintains a conversation state with a client application.
Most database driven applications that are developed using open source technologies have a three-tier structure. The web application itself runs in the browser of a desktop or a laptop. Users can only access the front end of the application to input data or search strings. Java being platform independent allows applications to be accessed on any device like a pda or cellphone or any telnet device.
Enterprise java bean application development occurs by employing a three-tier architecture consisting of a front end known as the web container, an EJB container, the third tier being the database. This three-tier structure has proved to be immensely useful for enterprise application development.
The application when accessed on any telnet device renders a user interface complete with data entry screens and submit buttons on to the user’s device. This interface is usually developed by using any of the technologies such as java server pages, java server faces, or java servlets. Any event fired by the user like a search string or a request to add certain items into a shopping cart invokes a call session bean running in an Enterprise java bean container. Any of the above-mentioned technologies JSP,JSF, java servlets can be used to call a session bean. Since the Enterprise java bean container is connected to the database, it has the capability to process the queries of the users. Once the session bean is invoked , it processes the request and sends a response back to the web application. The web application then formats the response as required and returns a response to the client end.
Being open source EJB application development has a very bright future in the enterprise application development space in the times to come.
Java Development Companies in India makes the J2EE Architecture more powerful with the help of java web development and Outsource Java services.
Jeff
Any mention of enterprise java bean application development would be incomplete without gaining an understanding of what a java session bean actually is. Java session beans are actually java components that run in either stand –alone EJB containers or EJB containers that are part of the standard java platform enterprise edition application servers. These java beans are typically used to model a particular task or use case such as input of customer information or executing a process that maintains a conversation state with a client application.
Most database driven applications that are developed using open source technologies have a three-tier structure. The web application itself runs in the browser of a desktop or a laptop. Users can only access the front end of the application to input data or search strings. Java being platform independent allows applications to be accessed on any device like a pda or cellphone or any telnet device.
Enterprise java bean application development occurs by employing a three-tier architecture consisting of a front end known as the web container, an EJB container, the third tier being the database. This three-tier structure has proved to be immensely useful for enterprise application development.
The application when accessed on any telnet device renders a user interface complete with data entry screens and submit buttons on to the user’s device. This interface is usually developed by using any of the technologies such as java server pages, java server faces, or java servlets. Any event fired by the user like a search string or a request to add certain items into a shopping cart invokes a call session bean running in an Enterprise java bean container. Any of the above-mentioned technologies JSP,JSF, java servlets can be used to call a session bean. Since the Enterprise java bean container is connected to the database, it has the capability to process the queries of the users. Once the session bean is invoked , it processes the request and sends a response back to the web application. The web application then formats the response as required and returns a response to the client end.
Being open source EJB application development has a very bright future in the enterprise application development space in the times to come.
Java Development Companies in India makes the J2EE Architecture more powerful with the help of java web development and Outsource Java services.
Jeff
Finding The Best PHP Dating Script Online
Ron McNeil asked:
Internet is offering great opportunities for all the talented individuals who have great passion to start their own business at a very low cost. If you have enough passion and dedication you can start a social networking site, a job site, an inorganic search engine or some other thing. Most of these businesses want a very low capital investment.
One such concept which is quite hot in the internet market is online dating. With the increasing number of singles using the internet all across the world to find exciting relations, the concept of online dating is becoming increasingly popular. Already there are so many popular online dating sites like Match, Great Expectations, Yahoo Personals, e Harmony, Friend finder and many more.
To replicate the success of these online dating business models and to grab a piece of this ever growing market, so many interested entrepreneurs are looking out for opportunities to start their own online dating business. The basic thing these entrepreneurs need to start their online dating business is a good PHP dating script. PHP is definitely the most popular technology platform as it is a open source platform and as it also supports object oriented programming concepts.
There are many vendors available over the internet marketplaces that are providing PHP dating scripts. Some of those PHP dating scripts are available for a permanent, one time fees. The cost of these PHP dating scripts can be any where between 400 USD to 3000 USD. Most of these PHP dating script come with lifetime free upgrades also. The buyer can use this PHP dating script on as many domains as he wishes.
Some other vendors are providing these PHP dating scripts on the basis of a license fee per domain. When the buyer wants to use the same PHP dating script for another domain, the buyer has to buy another license. In this case also, most of the vendors provide with lifetime free upgrades.
Some other vendors of these PHP dating scripts provide both the options. They even provide buyers with an option for a free trail for a limited period of time like 30 days or 60 days. Most of the times, the vendors also provide with an option of hosting the PHP dating script at their end.
There are some other vendors of these PHP dating scripts in the internet market place who are offering those scripts for free. However, the buyer of those PHP dating scripts should carry a small link which advertises the vendors product list or simply advertises the same PHP dating script which he bought from the vendor.
As a buyer of these PHP dating scripts you should keep a few fundamental things in mind while making a choice. First and foremost thing to see is the target market for your online dating business. After getting a good understanding of your target market you should be able to anticipate the type of requirements for your target market. This can be done by studying your competitor’s website business and by getting direct feedback from your prospective customers.
When you understand the basic demands of your prospective customers, you should list down all of them. Then you should try and find out a PHP dating script which can meets at least 80% of that wish list. You should also see how easy it will be to incorporate the remaining 20% features into that PHP dating script.
These points should give you a great understanding of the available PHP dating scripts in the internet market place. With this you can easily zero down to a single cost effective and efficient PHP dating script for your online dating business.
Given the great amount of choice available in the market place, the chances of finding a right PHP dating script is quite high. However, if you don’t find a PHP dating script which can meet at least 80% of your wish list and which can get the rest 20% quite easily; you shouldn’t get compromised.
You should put in some quality time and prepare a concrete SRS (Software Requirement Specifications). After preparing a perfect SRS you should try and find a good and professional PHP programmer along with a professional designer, even on a freelancing basis to develop your PHP dating script. You can find one on freelance market places like Rent A Coder or e Lance.
Hence, only the passion for the business and the dedication which can show can yield the results which you are looking for in your online dating business.
Vanessa
Internet is offering great opportunities for all the talented individuals who have great passion to start their own business at a very low cost. If you have enough passion and dedication you can start a social networking site, a job site, an inorganic search engine or some other thing. Most of these businesses want a very low capital investment.
One such concept which is quite hot in the internet market is online dating. With the increasing number of singles using the internet all across the world to find exciting relations, the concept of online dating is becoming increasingly popular. Already there are so many popular online dating sites like Match, Great Expectations, Yahoo Personals, e Harmony, Friend finder and many more.
To replicate the success of these online dating business models and to grab a piece of this ever growing market, so many interested entrepreneurs are looking out for opportunities to start their own online dating business. The basic thing these entrepreneurs need to start their online dating business is a good PHP dating script. PHP is definitely the most popular technology platform as it is a open source platform and as it also supports object oriented programming concepts.
There are many vendors available over the internet marketplaces that are providing PHP dating scripts. Some of those PHP dating scripts are available for a permanent, one time fees. The cost of these PHP dating scripts can be any where between 400 USD to 3000 USD. Most of these PHP dating script come with lifetime free upgrades also. The buyer can use this PHP dating script on as many domains as he wishes.
Some other vendors are providing these PHP dating scripts on the basis of a license fee per domain. When the buyer wants to use the same PHP dating script for another domain, the buyer has to buy another license. In this case also, most of the vendors provide with lifetime free upgrades.
Some other vendors of these PHP dating scripts provide both the options. They even provide buyers with an option for a free trail for a limited period of time like 30 days or 60 days. Most of the times, the vendors also provide with an option of hosting the PHP dating script at their end.
There are some other vendors of these PHP dating scripts in the internet market place who are offering those scripts for free. However, the buyer of those PHP dating scripts should carry a small link which advertises the vendors product list or simply advertises the same PHP dating script which he bought from the vendor.
As a buyer of these PHP dating scripts you should keep a few fundamental things in mind while making a choice. First and foremost thing to see is the target market for your online dating business. After getting a good understanding of your target market you should be able to anticipate the type of requirements for your target market. This can be done by studying your competitor’s website business and by getting direct feedback from your prospective customers.
When you understand the basic demands of your prospective customers, you should list down all of them. Then you should try and find out a PHP dating script which can meets at least 80% of that wish list. You should also see how easy it will be to incorporate the remaining 20% features into that PHP dating script.
These points should give you a great understanding of the available PHP dating scripts in the internet market place. With this you can easily zero down to a single cost effective and efficient PHP dating script for your online dating business.
Given the great amount of choice available in the market place, the chances of finding a right PHP dating script is quite high. However, if you don’t find a PHP dating script which can meet at least 80% of your wish list and which can get the rest 20% quite easily; you shouldn’t get compromised.
You should put in some quality time and prepare a concrete SRS (Software Requirement Specifications). After preparing a perfect SRS you should try and find a good and professional PHP programmer along with a professional designer, even on a freelancing basis to develop your PHP dating script. You can find one on freelance market places like Rent A Coder or e Lance.
Hence, only the passion for the business and the dedication which can show can yield the results which you are looking for in your online dating business.
Vanessa




