Showing posts with label Security. Show all posts
Showing posts with label Security. Show all posts

Friday, April 27, 2018

Cyber Security Terminology - 2

Cyber Security - Terminology - List 2

Social Engineering: Social engineering is essentially the art of gaining access to buildings, computer systems or data by exploiting human psychology, rather than by breaking in or using technical hacking techniques.

Email spoofing: Email spoofing is the creation of email messages with a forged sender address. Email spoofing is the forgery of an email header so that the message appears to have originated from someone or somewhere other than the actual source. Email spoofing is a tactic used in phishing and spam campaigns because people are more likely to open an email when they think it has been sent by a legitimate source.

Active Attacks: An active attack is a network exploit in which a hacker attempts to make changes to data on the target or data en route to the target.

Passive Active: A passive attack is a network attack in which a system is monitored and sometimes scanned for open ports and vulnerabilities. The purpose is solely to gain information about the target and no data is changed on the target. Passive attacks include active reconnaissance and passive reconnaissance.

Types of Cyber security Attacks
  • Phishing Attacks.
  • SQL Injection Attacks (SQLi)
  • Cross-Site Scripting (XSS)
  • Man-in-the-Middle (MITM) Attacks.
  • Malware Attacks.
  • Denial-of-Service Attacks, etc..
Authentication: the process or action of verifying the identity of a user or process.

Confidentiality: Confidentiality is the protection of personal information. Confidentiality means keeping a client's information between you and the client, and not telling others including co-workers, friends, family, etc. Examples of maintaining confidentiality include: individual files are locked and secured.

Cyber space: the notional environment in which communication over computer networks occurs. Cyberspace refers to the virtual computer world, and more specifically, is an electronic medium used to form a global computer network to facilitate online communication. It is a large computer network made up of many worldwide computer networks that employ TCP/IP protocol.

Certifying Authority: A certificate authority (CA) is a trusted entity that issues electronic documents that verify a digital entity's identity on the Internet. The electronic documents, which are called digital certificates, are an essential part of secure communication and play an important part in the public key infrastructure (PKI).

Domain name: A domain name is your website name. A domain name is the address where Internet users can access your website. A domain name is used for finding and identifying computers on the Internet.

Intellectual property: Intellectual property (IP) is a category of property that includes intangible creations of the human intellect, and primarily encompasses copyrights, patents, and trademarks.

Jurisdiction: the official power to make legal decisions and judgements.

Brute force attack: A brute force attack is a trial-and-error method used to obtain information such as a user password or personal identification number (PIN). In a brute force attack, automated software is used to generate a large number of consecutive guesses as to the value of the desired data.

Salami attack: A “salami attack” is a form of cybercrime usually used for the purpose of committing financial crimes in which criminals steal money or resources a bit at a time from financial accounts.

References: https://en.wikipedia.org

Monday, April 23, 2018

Cyber Security Terminology-1


Basic Terminology related to Cyber Security

Information systems: An information system (IS) is an organized system for the collection, organization, storage and communication of information.

Information management: Information management (IM) is the process of collecting, storing, managing and maintaining information in all its forms.

Security Attacks: In computer and computer networks an attack is any attempt to expose, alter, disable, destroy, steal or gain unauthorized access to or make unauthorized use of an Asset.

Three Basic Security Goals: The three basic security goals are confidentiality, integrity, and availability. All information security measures try to address at least one of three goals.

Computer Criminals: Convicted computer criminals are people who are caught and convicted of computer crimes such as breaking into computers or computer networks.

Viruses: A computer virus is a type of malicious software program ("malware") that, when executed, replicates itself by modifying other computer programs and inserting its own code.

It is a piece of code which is capable of copying itself and typically has a detrimental effect, such as corrupting the system or destroying data.

Malicious Code: Malicious code is the term used to describe any code in any part of a software system or script that is intended to cause undesired effects, security breaches or damage to a system. Malicious code is an application security threat that cannot be efficiently controlled by conventional antivirus software alone.

System Threats: System threats refers to misuse of system services and network connections to put user in trouble. System threats can be used to launch program threats on a complete network called as program attack. System threats creates such an environment that operating system resources/ user files are misused.

Physical Security: Physical security is the protection of personnel, hardware, software, networks and data from physical actions and events that could cause serious loss or damage to an enterprise, agency or institution. This includes protection from fire, flood, natural disasters, burglary, theft, vandalism and terrorism.

Physical Access Control: In the fields of physical security and information security, access control (AC) is the selective restriction of access to a place or other resource. The act of accessing may mean consuming, entering, or using. ... Locks and login credentials are two analogous mechanisms of access control.

Windows File Protection (WFP), a sub-system included in Microsoft Windows operating systems of the Windows 2000 and Windows XP era, aims to prevent programs from replacing critical Windows system files. Protecting core system files mitigates problems such as DLL hell with programs and the operating system.

Network Security: Network security consists of the policies and practices adopted to prevent and monitor unauthorized access, misuse, modification, or denial of a computer network and network-accessible resources.

Intrusion Detection System: An intrusion detection system (IDS) is a device or software application that monitors a network or systems for malicious activity or policy violations.

Privacy on the Web/ Internet Privacy: Internet privacy involves the right or mandate of personal privacy concerning the storing, repurposing, provision to third parties, and displaying of information pertaining to oneself via of the Internet. Internet privacy is a subset of data privacy.

References: https://en.wikipedia.org


Click here to read more Cyber Security Terminology.

Thursday, March 2, 2017

AES Encryption Decryption

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.Key;
import javax.crypto.Cipher;
import javax.crypto.CipherInputStream;
import javax.crypto.KeyGenerator;

public class AESEncryptionDecryption {
   
    public static void main(String[] args) {
      try{
          Cipher cipher = Cipher.getInstance("AES");
          KeyGenerator kg = KeyGenerator.getInstance("AES");
          Key key = kg.generateKey();

          cipher.init(Cipher.ENCRYPT_MODE, key);
          CipherInputStream cipt=new CipherInputStream(new FileInputStream(new File("D:\\PlainTextInput.txt")), cipher);
          FileOutputStream fip=new FileOutputStream(new File("D:\\EncryptedText.txt"));

          int i;
          while((i=cipt.read())!=-1)
          {
             fip.write(i);
          }

          cipher.init(Cipher.DECRYPT_MODE, key);
          CipherInputStream ciptt=new CipherInputStream(new FileInputStream(new File("D:\\EncryptedText.txt")), cipher);
          FileOutputStream fop=new FileOutputStream(new File("D:\\DecryptedText.txt"));

          int j;
          while((j=ciptt.read())!=-1)
          {
             fop.write(j);
          }

        }
        catch(Exception e) {
           e.printStackTrace();
        }
      System.out.println("Encryption and Decryption of plain text file performed successfully.");
    }
}

Output of the program:

Encryption and Decryption of plain text file performed successfully.

Content of PlainTextInput.txt file: HelloStudent

Content of EncryptedText.txt file: ùóà ¬x9f¯—©c aá

Content of DecryptedText.txt file: HelloStudent 

Note: You need to create PlainTextInput.txt file in D:\ drive of computer. Execution of program will create EncryptedText.txt and DecryptedText.txt file in D:\ drive.

Saturday, February 25, 2017

RSA Decryption

#include<stdio.h>
int main()
{
long int n=187, d=23, m, c=11;
int i;
//Assuming input - Cipher text c=11.

printf("Sample Data:d=23, n=187, c=11\n");

m = 1;

for(i=0; i<d; i++){
m = m * c%n;
}
m = m%n;

printf("Plain Text of %i = %i",c,m);
return 0;
}

Output of program:

Sample Data:d=23, n=187, c=11
Plain Text of 11 = 88

RSA Encryption

Sample values taken for execution of RSA encryption are as under:

      e=7, d=23, n=187 and m=88

#include<stdio.h>
int main()
{
  long int e=7,n=187,d=23, m=88, c;
  int i;
  //you may read e,n,d and m from user.

  printf("Sample Data:e=7, d=23, n=187, m=88\n");

  c=1;
  for(i=0; i<e; i++)
{
    c = c*m%n;
  }
  c = c%n;
  printf("Cipher Text of %i = %i \n",m, c);

  return 0;
}

Output of program:

Sample Data:e=7, d=23, n=187, m=88
Cipher Text of 88 = 11



Friday, February 10, 2017

Key generation in Simplified DES

Simplified DES - Key Generation Simulation Program using C Programming


DES means Data Encryption Standard. DES is one of the top cryptographic software security algorithm used for providing security in many information systems. This c programming tutorial will help you to generate secure password (encryption key).

Assumptions for this program: 
  • 10 bits input size
  • Perform Left Shift - 1 (LS-1) on both the halfs
  • Display Key k1 as final output.
#include<stdio.h>
int main()
{
int i, cnt=0, p8[8]={6,7,8,9,1,2,3,4};
int p10[10]={6,7,8,9,10,1,2,3,4,5};

char input[11], k1[10], k2[10], temp[11];
char LS1[5], LS2[5];
//k1, k2 are for storing interim keys
//p8 and p10 are for storing permutation key

//Read 10 bits from user...
printf("Enter 10 bits input:");
scanf("%s",input);
input[10]='\0';

//Applying p10...
for(i=0; i<10; i++)
{
cnt = p10[i];
temp[i] = input[cnt-1];
}
temp[i]='\0';
printf("\nYour p10 key is    :");
for(i=0; i<10; i++)
{ printf("%d,",p10[i]); }

printf("\nBits after p10     :");
puts(temp);
//Performing LS-1 on first half of temp
for(i=0; i<5; i++)
{
if(i==4)
temp[i]=temp[0];
else
temp[i]=temp[i+1];
}
//Performing LS-1 on second half of temp
for(i=5; i<10; i++)
{
if(i==9)
temp[i]=temp[5];
else
temp[i]=temp[i+1];
}
printf("Output after LS-1  :");
puts(temp);

printf("\nYour p8 key is     :");
for(i=0; i<8; i++)
{ printf("%d,",p8[i]); }

//Applying p8...
for(i=0; i<8; i++)
{
cnt = p8[i];
k1[i] = temp[cnt-1];
}
printf("\nYour key k1 is     :");
puts(k1);
//This program can be extended to generate k2 as per DES algorithm.
}

Output of program

Enter 10 bits input:1100011100

Your p10 key is    :6,7,8,9,10,1,2,3,4,5,
Bits after p10     :1110011000
Output after LS-1  :1100110001

Your p8 key is     :6,7,8,9,1,2,3,4,
Your key k1 is     :10001100


You may also like to view following Computer Security Programs:


Wednesday, February 8, 2017

Simplified DES - Initial Permutation function

Simulation of Simplified DES - Initial Permutation function.
Note: Validations, Exceptions are to be added by programmer.


#include<stdio.h>
int main()
{
int IPkey[8]={1,6,7,8,5,2,3,4};
int i, cnt;
char input[9], output[9];

printf("Enter your 8 bits input:");
scanf("%s",input);
input[8]='\0';
printf("Your input is:%s\n", input);
printf("IP key used : ");
for(i=0; i<8; i++) {
printf("%d",IPkey[i]);
}
printf("\n");
for(i=0; i<8; i++)
{
cnt=IPkey[i];
output[i]=input[cnt-1];
}
output[8]='\0';

printf("Your output is %s", output);
return 0;
}

Output of the program

Enter your 8 bits input:10011101
Your input is:10011101
IP key used : 16785234
Your output is 11011001

Sunday, February 5, 2017

Playfair Decryption


Playfair Decryption implementation 


Assumptions: 
  • Assume key matrix is given to us. 
  • Read cipher text (2 characters) from user. 
  • This program demonstrate four rules of the Playfair decryption algorithm. 
  • This program will process only 2 characters input. You may extend to process n characters by repeating given logic.

#include<stdio.h>
int main()
{

char arr[5][5]={"MONAR","CHYBD","EFGIK","LPQST","UVWXZ"};
char ct[10];

int i, j, r1=0, r2=0, c1=0, c2=0;
printf("Plaifair Keymatrix\n=================\n");
for(i=0; i<5; i++)
{
for(j=0; j<5; j++)
printf("%c ", arr[i][j]);
printf("\n");
}

printf("Enter your cipher text:");
scanf("%s",ct);
printf("Your cipher text is %s\n", ct);

for(i=0; i<5; i++)
{
for(j=0; j<5; j++)
{
if(arr[i][j] == ct[0])
{
r1=i; c1=j;
}
if(arr[i][j] == ct[1])
{
r2=i; c2=j;
}
}
}
if(r1==r2) //Rule2-when both characters in same row
{
if(c2==0) //for char in last column
printf("Plaintext = %c%c \n", arr[r1][c1-1], arr[r2][4]);
else
printf("Plaintext = %c%c \n", arr[r1][c1-1], arr[r2][c2-1]);
}
if(c1==c2)//Rule3- when both characters in same column
{
if(r2==0) //for char in last row
printf("Plaintext = %c%c \n", arr[r1-1][c1], arr[4][c2]); 
else
printf("Plaintext = %c%c \n", arr[r1-1][c1], arr[r2-1][c2]); 
}
//Rule4 when characters are not in a same row and column
if(r1 != r2 && c1 != c2) 
{
printf("Plaintext = %c%c \n", arr[r1][c2], arr[r2][c1]); 
}
return 0;
}

Output of the program

Plaifair Keymatrix
=================
M O N A R
C H Y B D
E F G I K
L P Q S T
U V W X Z
Enter your cipher text:NA
Your cipher text is NA

Plaintext = ON

Click here to check Playfair Encryption Program

Playfair Encryption

Playfair Encryption implementation 

Playfair is one of the popular cryptographic software security algorithms. This technique encrypts pairs of letters at a time and generates more secure encrypted text compare to  the simple substitution cipher like Caesar.

Assumptions:
  • Assume key matrix is given to us. 
  • Read plain text(2 characters) from user.
  • This program demonstrate four rules of the Playfair encryption algorithm.
  • This program will process only 2 characters input. 
  • You may extend to process n characters by repeating given logic.
  • Add suitable exception for completing this program.

#include<stdio.h>
int main(){
 
  char arr[5][5]={"MONAR","CHYBD","EFGIK","LPQST","UVWXZ"};
  char pt[10];
 
  int i, j, r1=0, r2=0, c1=0, c2=0;
  printf("Playfair Keymatrix\n==================\n");
  for(i=0; i<5; i++)
  {
    for(j=0; j<5; j++)
    printf("%c ", arr[i][j]);
    printf("\n");
  }
 
  printf("Enter your plain text:");
  scanf("%s",pt);
  printf("Your plain text = %s", pt);
 
  for(i=0; i<5; i++)
  {
    for(j=0; j<5; j++)
    {
       if(arr[i][j] == pt[0])
       {
         r1=i; c1=j;
       }
       if(arr[i][j] == pt[1])
       {
         r2=i; c2=j;
       }
    }
  }
  if(r1==r2) //when both characters in same row
  {
    if(c2==4) //for char in last column
       printf("Ciphertext = %c%c \n", arr[r1][c1+1], arr[r2][0]);  
    else
       printf("Ciphertext = %c%c \n", arr[r1][c1+1], arr[r2][c2+1]);
  }
  if(c1==c2)//when both characters in same column
  {
    if(r2==4) //for char in last row
       printf("Ciphertext = %c%c \n", arr[r1+1][c1], arr[0][c2]);
    else
       printf("Ciphertext = %c%c \n", arr[r1+1][c1], arr[r2+1][c2]);
  }
  //when characters are not in a same row and column
  if(r1 != r2 && c1 != c2)
  {
    printf("\nCiphertext = %c%c \n", arr[r1][c2], arr[r2][c1]);
  }
  return 0;
}

Output of the program

Playfair Keymatrix
==================
M O N A R
C H Y B D
E F G I K
L P Q S T
U V W X Z
Enter your plain text:IN
Your plain text = IN
Ciphertext = GA


>>> Playfair Decryption Program


Simple Railfense - Encryption


//Simple Railfense Technique - Sender side encryption logic.
#include<stdio.h>
int main()
{
  char str[20], str1[10]="", str2[10]="";
  int i, cnt1=0, cnt2=0;

  printf("Enter your plain text:");
  gets(str);

  for(i=0; i<strlen(str); i++)
  {
  if( i%2 == 0)
  {
str1[cnt1++]=str[i];
  }
  else
str2[cnt2++]=str[i];
  }
  printf("Encrypted Text = %s%s",str1,str2);
  return 0;
}

Output of the program

Enter your plain text:HelloStudent
Encrypted Text = HlotdnelSuet



Saturday, January 28, 2017

Playfair Key Matrix Generation: Keyword validation according to the specification given in the algorithm.


/*Playfair Key Matrix Generation: Keyword validation according to the specification given in the algorithm.*/

#include<stdio.h>

int main(){

  char key[10];
  int i,j,flag=0, cnt=0, key_check[26]={};

  printf("Enter your keyword:");
  scanf("%s",key);

  //Logic to count character frequency in MONARCHY
  for(i=0; i<strlen(key); i++)
  {
key_check[key[i]%65]++;
  }

  for(i=0; i<26; i++)
  {
if(key_check[i] > 1)
flag=1;
//Logic to display frequency
//printf("%c=%d \n",i+65, key_check[i]);
  }

  if(flag==1)
printf("Keyword %s is not suitable for generating Playfair Key Matrix.", key);
  else
printf("Keyword %s is ok for generating Playfair Key Matrix.", key);

  return 0;
}

//This program will check only keywords enter in Capital letters.

Output - 1
Enter your keyword:MONARCHY
Keyword MONARCHY is ok for generating Playfair Key Matrix.

Output - 2
Enter your keyword:HELLO
Keyword HELLO is not suitable for generating Playfair Key Matrix.


Monday, December 26, 2016

Simple Rail Fence - Encryption using C program.

Rail fence Simple - Encryption implementation using C program.

#include<stdio.h>
int main()
{
  char str[20]="HelloStudent", str1[10]="", str2[10]="";
  int i, cnt1=0, cnt2=0;
  printf("Rail Fence - Encryption\n\n");
  printf("Plain Text: HelloStudent\n\n");

  for(i=0; i<strlen(str); i++)
  {
    if( i%2 == 0)
    {
      str1[cnt1++]=str[i];
    }
    else
  str2[cnt2++]=str[i];
  }
  printf("Cipher Text: %s%s",str1,str2);
  return 0;
}

Output of the program:

Rail Fence - Encryption

Plain Text: HelloStudent

Cipher Text: HlotdnelSuet


* * * * *
* * * * *