Home » security » Page 3

Tag Archives: security

DES with CBC example

Bipartite Graph

With this example we are going to demonstrate how to encrypt data using the DES algorithm in CBC mode. In short, to encrypt/decrypt a String message with the Data Encryption Standard algorithm, in Chipher Block Chaining mode you should: Create a byte array to be used as initial input, a byte array to be used as a key and a ...

Read More »

DES with CTR example

Bipartite Graph

This is an example of how to encrypt data using the DES algorithm in CTR mode. Doing data encryption with the Data Encryption Standard algorithm, in CTR mode implies that you should: Create a byte array to be used as initial password to be encrypted, a byte array to be used as a key and a a byte array to ...

Read More »

Encrypt/Decrypt with with AES/ECB/PKCS7Padding

Bipartite Graph

In this example we shall show you how to encrypt/decrypt data with the AES/ECB/PKCS 7Padding. To encrypt data using the AES algorithm,in ECB mode and with PKCS7Padding one should perform the following steps: Create a byte array to be used as input to be encrypted and a byte array to be used as a key. Create a new SecretKeySpec for ...

Read More »

Symmetric encryption example

Bipartite Graph

With this example we are going to demonstrate how to make a symmetric encryption and decryption. In symmetric encryption the same key is used for both encryption of plaintext and decryption of ciphertext. In short, to make a symmetric encryption you should: Create a byte array from the initial password and a byte array from the initial key. Create a ...

Read More »

AWTPermission example

Bipartite Graph

This is an example of how to create an AWTPermission. AWTPermissions are permissions granted for the AWT Package of Java. In the AWTPermission API there is a list of all the possible AWTPermission target names, and for each one, there is a description of what the permission allows and a discussion of the risks of granting code the permission. In ...

Read More »

AccessController example

Bipartite Graph

In this example we shall show you how to create and check an access permission to a file, using the AccessController Class. To create a new permission to a file and check the access permission of a file, one should perform the following steps: Create a new FilePermission with the specified path of the file and action mode of the ...

Read More »

Signing a Java Object example

Bipartite Graph

With this example we are going to demonstrate how to sign a Java Object. In particular, we will use the Digital Signature Algorithm (DSA) to create a 1024-bit key pair and then sign a Serializable Object, using the key pair Signature. In short, to sign an Object in Java you should: Create a KeyPairGenerator for the DSA algorithm and initialize ...

Read More »

Get DSA parameters of a key pair example

Bipartite Graph

This is an example of how to get DSA parameters of a key pair. In short, to get the DSA parameters of a key pair you should: Generate a 1024-bit Digital Signature Algorithm (DSA) key pair. Create a KeyPairGenerator for the DSA algorithm and initialize it with 1024-bit key size. Generate the KeyPair. Get the private and public key from ...

Read More »

Get bytes of a key pair example

Bipartite Graph

In this example we shall show you how to get the bytes of a key pair in Java. To get the bytes of a key pair one should perform the following steps: Create a KeyPairGenerator for the DSA algorithm and initialize it with a 1024-bit key size. Generate the KeyPair, with the genKeyPair() API method of the KeyPairGenerator. Get the ...

Read More »

Generate Public/Private key pairs for DSA DH RSA algorithm example

Bipartite Graph

With this example we are going to demonstrate how to generate private/public key pairs for the DSA, the DH and the RSA algorithms. In short, to generate key pairs for these three algorithms you should: Create a KeyPairGenerator for the DSA algorithm, using the getInstance(String algorithm) API method and initialize it with a 1024-bit key size. Generate the KeyPair, with ...

Read More »