Cryptography: Implement A Restful Web Service
Cryptography: Implement A Restful Web Service
pg. 1
// <script src="https://maps.googleapis.com/maps/api/js?
key=YOUR_API_KEY&libraries=places">
let map;
let service;
let infowindow;
function initMap() {
const sydney = new google.maps.LatLng(21.4735o, 55.9754o);
infowindow = new google.maps.InfoWindow();
map = new google.maps.Map(document.getElementById("map"), {
center: sydney,
zoom: 10,
});
const request = {
query: "National Museum of Oman",
fields: ["name", "geometry"],
};
service = new google.maps.places.PlacesService(map);
service.findPlaceFromQuery(request, (results, status) => {
if (status === google.maps.places.PlacesServiceStatus.OK) {
for (let i = 0; i < results.length; i++) {
createMarker(results[i]);
}
map.setCenter(results[0].geometry.location);
}
});
}
function createMarker(place) {
const marker = new google.maps.Marker({
map,
position: place.geometry.location,
});
google.maps.event.addListener(marker, "click", () => {
infowindow.setContent(place.name);
infowindow.open(map);
pg. 2
});
}
Modular Math and the Shift Cipher
The Caesar Cipher is a type of Chipher going. Shift the Cipher method using the Module
Operator to encrypt and decode messages. There is an integer in the Shift Cypher from 0 to
25. We can share this key only with people who want to see our message. The Caesar Cipher
is a type of Chipher going. Shift the Cipher method using the Module Operator to encrypt and
decode messages. There is an integer in the Shift Cypher from 0 to 25. We can share this key
only with people who want to see our message.
How to Encrypt:
For every letter in the message M:
1. Turn the letter to the number in the alphabet that fits the number from 0, then call this
number X.
2. ( A=0, B=1, C=2, ...,Y=24, Z=25)
3. Calculate: Y = (X + K) mod 26
4. Convert the number Y into a letter that matches its order in the alphabet starting from 0.
5. (A=0, B=1, C=2, ...,Y=24, Z=25)
For Example: We agree with our friend to use the Shift Cipher with key K=19 for our
message.
We encrypt the message "SALIM", as follows:
ENCRYPTION DECRYPTION
W A A D R O S E
9 17 10 16 5 0 12 9
+ 55 55 55 55 - 55 55 55 55
(64 72 65 71) mod 26 ( -52 -50 -3 -44 ) mod 26
5 0 12 9 9 17 10 16
R O S E W A A D
So, after applying the Shift Cipher with key K=19 our message text "SALIM" gave us cipher
text "HILAL".
We give the message "DATG" to our friend.
pg. 3
How to decrypt:
For every letter in the cipher text C :
1. Convert the letter into the number that matches its order in the alphabet starting from 0,
and call this number Y.
2. (A=0, B=1, C=2, ..., Y=24, Z=25)
3. Calculate: X= (Y - K) mod 26
4. Convert the number X into a letter that matches its order in the alphabet starting from 0.
5. (A=0, B=1, C=2, ..., Y=24, Z=25)
Our friend now decodes the message using our agreed upon key K=19. As follows:
DECRYPTION
3 0 19 6 5
- 19 19 19 19 19
-16 -19 0 -13 -14
10 0 11 4 12
S A L I M
So, after decrypting the Shift Cipher with key K=19 our friend deciphers the cipher text
“HILAL “into the message text "SALIM".
Why is the Shift Cipher insecure?
A cipher should prevent an attacker, who has a copy of the cipher text but does not know the
key, from discovering the contents of the message. Since we only have 26 choices for the
key, someone can easily try all of the 26 keys, one by one, until they recover the message.
This type of attack is called a brute force attack.
High availability is a computational infrastructure quality that enables it to continue running
even though any of its components malfunction. This is important for mission-critical
networks that cannot survive a service interruption, and errors can cause financial disruption
or loss.
A certain amount in the uptime of highly open networks is ensured – for instance, a device
with 99, 9% uptime is down 0, 1% of the time—0.365 days or8,76 hours a year. The "nines"
number is often used to denote the degree of high disponibility. E.g., a device that is 99,999%
higher is indicated by "five nines"
The basic elements of high availability
For a highly accessible framework, the following three elements are essential:
pg. 4
Redundancy— Ensure that any system operating components have another redundant
component, which can be taken over in the event of failure.
Monitoring— Collect data from a running device and detect the failure or stoppage of a
component.
Failover— a system that will automatically switch from the original active to a redundant
component if testing indicates an active component malfunction.
Technical components enabling high availability
In highly usable applications, the above systems are typically used to incorporate the
principles of redundancy, supervision, and failure:
Data backup and recovery—a device that backs up and restores data to source
automatically at a secondary site. It will be done to configure redundancies and faults. Read
more in our detailed Azure backup section.
Load balancing— A load balancer administers traffic, distributing it between more than one
traffic-enabled device. The load balancer will be aware of the failed one of the target systems,
and divert traffic to another system, thus conducting surveillance and malfunction.
Clustering— a cluster comprises several nodes for a multitude of reasons, and users
normally connect the whole cluster and interpret it as one entity. If a failure occurs, any node
in the cluster will fail to any node. You can establish redundancy between cluster nodes by
setting up replication within the cluster.
pg. 5
A 5-Step Azure High Availability Checklist
Microsoft Azure offers a wide range of methods and frameworks for reliability. These
include documented Azure Resources SLAs, frameworks for replication and remediation of
disasters, for example, azure backing and azure site recovery, health samples, and controlling
devices to collect operative status indicator data, and more.
Below is a simple checklist to help you meet your needs and architecture by using Azure's
technology to help your high-display approach.
1. Set the criteria for accessibility
Define the cloud complexity and the user habits of the cloud.
Set metrics for your availability
These can include:
Percentage of Uptime
Mean Time to Recovery (MTTR)
Mean Time between Failures (MTBR)
Recovery Time Objective (RTO)
Recovery Point Objective (RPO)
Use these variables to describe for each depth knowledge the SLA (Destination Service Level
Agreement).
Find the Azure Resources Microsoft SLAs
For any Azure operation, Microsoft determines its own SLA. To view the assured SLA for
the facilities you need, check Azure's documents. You should customize redundancy
elements with failover if you need a higher SLA than Azure guarantees.
2. Plan the infrastructure for highly available
Start an overview of component failure (FMA)
pg. 6
Describe different types of errors, the consequences, and the sustainability report of each
type. Classify the durability level needed for each part based on your FMA.
Avoid single points of failure and use load balancing to spread demands between redundant
modules.
Consider costs
Note that any redundant layer doubles the cloud costs effectively (at least for the period the
redundant component is active). Ensure that you have permits and services for extra
redundant cases, such as bandwidth, storage, or network.
Consider resiliency
Ensure the processes graciously malfunction and re-establish activities beyond service
interruption. Isolate vital capital, use compensatory transfers, and use synchronized
transactions to guarantee that activities on a replicated element will proceed whenever a
failure occurs.
Replicate data
Make sure the application details are recycled such that the replication and RTO and RPO
plan are assisted. If you have not copied fresh data to the redundant portion before a failure, it
is difficult to fail or recover.
Document everything
Document the measures required to fail to render a redundant item—whether automatically or
manually—and retrieve or "fail" it from its original component. In case of emergencies,
directions should be sufficiently brief and simple for use.
3. Perform End-to-End Testing
You must measure the system under practical conditions of failure to ensure reliability. To
monitor multiple failure situations including a combination of faults, use fault injection
checks, and calculate recovery times. Failure and failback checking both.
You should carry out additional tests to strengthen the trust:
Identify failures under load— Realistic load checks are carried out before a system
breaks down and the failure cycles are detected.
Run disaster recovery exercises— Conduct a planned or unplanned trial where
processes are working and the team has to work rapidly in compliance with the
disaster recovery rehears.
Test health probes— to detect part loss, the Azure Load Balancer uses health probes.
Check the samples so that in event of error they give the correct answer.
pg. 7
Test monitoring systems— Reviews annually the accuracy of surveillance system
data to make sure the fault is observed in time.
4. Deploy Applications Consistently
Any change can result in failure
The added modifications could fail if you provide Azure VMs or other facilities, deploy new
application code, and modify the setup. Automated, reliable implementation will reduce the
risk of delays and mistakes and make it easy to recover.
Consider availability in your release process
If you have Azure VM or other facilities, implement new application code, and change the
configuration, the additional modifications can fail. Automated, efficient execution can
eliminate and make it easier to recover the probability of delays and errors.
Plan for rollback
Design a rollback mechanism that will help you recover programs in an earlier operating
version automatically. Implementations must be streamlined so that a full framework can be
spun that reflects the last known setup.
To detect loss in time, use samples and verify functions5.
Monitor Application Health
Failures are highly essential for high availability of time. Using azure health samples and
search functionality to receive fresh information on the provision of facilities. You should
still try to perform control functions outside an application.
Watch degrading health metrics
Don't just be vigilant of the total loss. Degrading health tests will warn that failure is on the
verge of failure. Defining important device health thresholds and alerting operators when the
device hits an issue threshold value, provides an early warning mechanism.
Leverage logging and auditing
Using comprehensive log and audit capabilities: semantine and asynchronous logging,
separate application logs from audit logs, and remote call statistics metrics such as latency,
performance, and error percentage.
Watch subscription limits
You will suffer errors if you exceed the authorized constraints of one of your Azure services.
Make sure you understand each Azure service you use and track the limited data before
additional amount space, compute, process, and other limitations.
pg. 8
Reference
[1] A. P. U. Siahaan, “Factorization Hack of RSA Secret Numbers,” International Journal
. of Engineering Trends and Technology, vol. 37, no. 1, pp. 15-18, 2016.
[2] M. Reza dan M. A. Budiman, “Simulasi Pengamanan File Teks Menggunakan
. Algoritma Massey-Omura,” Jurnal Dunia Teknologi Informasi, vol. 1, no. 1, pp. 20-
27, 2012.
[3] A. Dony, Pengantar Ilmu Kriptografi Teori Analisis dan Implementasi, Yogyakarta:
. Andi Offset, 2008.
[4] Mollin, An Introduction to Cryptography. Second Edition, Taylor & Francis Group,
. 2007.
[5] Y. Kanamori dan S.-M. Yoo, “Quantum Three-Pass Protocol : Key Distribution Using
. Quantum Super Position States,” International Journal of Network Security & Its
Applications, vol. 1, no. 2, pp. 64-70, 2009.
[6] B. Oktaviana, “Kombinasi Vigenere Cipher Dengan Caesar Cipher Dalam Three-Pass
. Protocol,” Tesis. Pasca Sarjana Teknik Informatika USU, Medan, 2012.
[7] A. P. U. Siahaan, “RC4 Technique in Visual Cryptography RGB Image Encryption,”
. International Journal of Computer Science and Engineering, vol. 3, no. 7, pp. 1-6,
2016.
pg. 9