Cryptography
Cryptography
Cryptography
Symmetric-key cryptography
Comparison
Symmetric Encryption Asymmetric Encryption
Factor
Number of Asymmetric Encryption
Symmetric encryption
Cryptographic consists of two
incorporates only one
Keys cryptographic keys. These
key for encryption as keys are regarded
well as decryption. as Public Key and Private
Key.
Symmetric encryption is
Contribution from
a simple technique
separate keys for
compared to asymmetric
Complexity encryption and decryption
encryption as only one
makes it a rather complex
key is employed to carry
process.
out both the operations.
Because of encryption and
Due to its simplistic
decryption by two
nature, both the
Swiftness of separate keys and the
operations can be
Execution process of comparing
carried out pretty
them make it a tad slow
quickly.
procedure.
RC4 RSA
AES Diffie-Hellman
Algorithms
DES ECC
Employed
3DES El Gamal
QUAD DSA
Asymmetric Algorithms
Ed25519 signing
Returns: Ed25519PrivateKey
Step2:
Parameter: data (bytes-like) – 32 byte private key
Returns: Ed25519PrivateKey
>>> from cryptography.hazmat.primitives import serialization
>>> from cryptography.hazmat.primitives.asymmetric import
ed25519
>>> private_key = ed25519.Ed25519PrivateKey.generate()
>>> private_bytes = private_key.private_bytes(
... encoding=serialization.Encoding.Raw,
... format=serialization.PrivateFormat.Raw,
... encryption_algorithm=serialization.NoEncryption()
... )
>>> loaded_private_key =
ed25519.Ed25519PrivateKey.from_private_bytes(private_bytes)
Step3: public_key()
Returns: Ed25519PublicKey
Step4: sign(data)
Parameters: data (bytes) – The data to sign.
Returns bytes: The 64 byte signature.
Step5:
Returns: Ed25519PublicKey
>>> from cryptography.hazmat.primitives import serialization
>>> from cryptography.hazmat.primitives.asymmetric import
ed25519
>>> private_key = ed25519.Ed25519PrivateKey.generate()
>>> public_key = private_key.public_key()
>>> public_bytes = public_key.public_bytes(
... encoding=serialization.Encoding.Raw,
... format=serialization.PublicFormat.Raw
... )
>>> loaded_public_key =
ed25519.Ed25519PublicKey.from_public_bytes(public_bytes)
Step6: verify(signature, data)
signature (bytes) – The signature to verify.
Parameters: data (bytes) – The data to verify.
Raises:
RSA
Generation
Key loading
If you already have an on-disk key in the PEM format (which are
recognizable by the distinctive -----BEGIN {format}----- and -----
END {format}----- markers), you can load it:
There is also support for loading public keys in the SSH format
Key serialization
Signing
A private key can be used to sign a message. This allows anyone with
the public key to verify that the message was created by someone
who possesses the corresponding private key. RSA signatures require
a specific hash function, and padding to be used. Here is an example
of signing message using RSA, with a secure hash function and
padding:
If your data is too large to be passed in a single call, you can hash it
separately and pass that value using Prehashed .
Verification
If your data is too large to be passed in a single call, you can hash it
separately and pass that value using Prehashed .
>>> chosen_hash = hashes.SHA256()
>>> hasher = hashes.Hash(chosen_hash, default_backend())
>>> hasher.update(b"data & ")
>>> hasher.update(b"more data")
>>> digest = hasher.finalize()
>>> public_key.verify(
... sig,
... digest,
... padding.PSS(
... mgf=padding.MGF1(hashes.SHA256()),
... salt_length=padding.PSS.MAX_LENGTH
... ),
... utils.Prehashed(chosen_hash)
... )
Encryption
Decryption
Conclusion
As we toward a society where automated information resources are
increased and cryptography will continue to increase in importance
as a security mechanism. Electronic networks for banking, shopping,
inventory control, benefit and service delivery, information storage
and retrieval, distributed processing, and government applications
will need improved methods for access control and data security.
The information security can be easily achieved by using
Cryptography technique. DES is now considered to be insecure for
some applications like banking system. there are also some analytical
results which demonstrate theoretical weaknesses in the cipher. So it
becomes very important to augment this algorithm by adding new
levels of security to make it applicable. By adding additional key,
modified S-Box design, modifies function implementation and
replacing the old XOR by a new operation as proposed by this thesis
to give more robustness to DES algorithm and make it stronger
against any kind of intruding. DES Encryption with two keys instead
of one key already will increase the efficiency of cryptography.