Schneier on Security: Cryptography Engineering

March 2010John Wiley & Sons384 PagesPaperbackISBN: 978-0470474242$55.00

Books>

A book by Niels Ferguson, Bruce Schneier, and Tadayoshi Kohno

A fully updated version of the bestselling Practical Cryptography.

Knowing how a camera works does not make you a great photographer. Knowing what cryptographic designs are and how existing cryptographic protocols work does not give you proficiency in using cryptography. You must learn to think like a cryptographer.

That is what this book will teach you. Dive deeply into specific, concrete cryptographic protocols and learn why certain decisions were made. Recognize the challenges and how to overcome them. With this book, which is suitable for both classroom and self-study, you will learn to use cryptography effectively in real-world systems.

Niels Ferguson is a cryptographer for Microsoft who has designed and implemented cryptographic algorithms,protocols, and large-scale security infrastructures. Bruce Schneier is an internationally renowned security technologist whose advice is sought by business, government, and the media. He is the author of Applied Cryptography, Secrets and Lies, and Schneier on Security. Tadayoshi Kohno is a professor at the University of Washington. He is known for his research and for developing innovative new approaches to cryptography and computer security education.

up to Books

Photo of Bruce Schneier by Per Ervland.

Schneier on Security is a personal website. Opinions expressed are not necessarily those of IBM Resilient.

Read more:
Schneier on Security: Cryptography Engineering

Welcome to Space 2018 | Space 2018

The International Conference on Security, Privacy and Applied Cryptography Engineering (SPACE) is an annual event devoted to various aspects of security, privacy, applied cryptography, and cryptographic engineering. The conferences started in 2011, and SPACE 2018 is the eighth in this series.

SPACE 2018is being organized by Indian Institute of Technology, Kanpur (IIT-K), in cooperation with International Association for Cryptologic Research (IACR) and Cryptology Research Society of India (CRSI)from 15 to 19 December, 2018. The program co-chairs for SPACE 2018 areDr. Anupam Chattopadhyay(NTU Singapore),Dr. Chester Rebeiro(IIT Madras, India), andDr. Yuval Yarom(The University of Adelaide and Data61, Australia).

The conference proceedings will be published by Springer as aSpringer LNCSvolume. The LNCS proceedings of the previous five years are available atSPACE 2017,SPACE 2016,SPACE 2015,SPACE 2014,SPACE 2013. The best contributions to SPACE 2018 will be selected for submission to regular issues of theJournal of Hardware and Systems Security (HASS).

Original papers are invited on all aspects that SPACE 2018 covers. Check theCall for Papers(PDF) for details.

Submission Due : 31 July 2018 (IST = GMT+5:30)Notification : 31 August 2018Final Version Due : 14 September 2018

Tutorials : 15 - 16 December 2018Conference : 17 - 19 December 2018

Deadline For Early Registration : 30 November 2018 (IST = GMT+5:30)

~late registration fee will be applied after the deadline~

See the original post:
Welcome to Space 2018 | Space 2018

cryptography – reddit

I was experimenting with RubberhoseFS, but since it is very hard to compile on anything modern, I decided to implement my own version, stripped of many unnecessary features. Namely, my implementation would only work on files (as opposed to drives/volumes/partitions), and in batch mode (no random access). However, before I start implementing it, I would like to verify that my understanding of RubberhoseFS is correct.

I wrote a full documentation of my intended implementation here, it contains all details of what I intend to do.

It boils down to this:

Is this comparable to what RubberhoseFS does? Does this seem like a reasonable implementation of Deniable Encryption?

Additionally, what is meant by the "Lattice generator"? Which primitives would I use to implement this?

And finally, RubberhoseFS uses a "whitening code" to prevent Known Plaintext Attacks. To my understanding, for each block, a random noise of the same size as half of the block is generated. The other half is then the plaintext, XORed with the random noise. Both of these are then encrypted using the key from the lattice generator, and stored in the block. Is this interpretation correct? And is whitening really necessary, if the key space is large?

View original post here:
cryptography - reddit

Public-key cryptography – Wikipedia

Public-key cryptography, or asymmetric cryptography, is a cryptographic system that uses pairs of keys: public keys which may be disseminated widely, and private keys which are known only to the owner. The generation of such keys depends on cryptographic algorithms based on mathematical problems to produce one-way functions. Effective security only requires keeping the private key private; the public key can be openly distributed without compromising security.[1]

In such a system, any person can encrypt a message using the receiver's public key, but that encrypted message can only be decrypted with the receiver's private key.

Robust authentication is also possible. A sender can combine a message with a private key to create a short digital signature on the message. Anyone with the corresponding public key can combine a message, a putative digital signature on it, and the known public key to verify whether the signature was valid, i.e. made by the owner of the corresponding private key.[2][3]

Public key algorithms are fundamental security ingredients in modern cryptosystems, applications and protocols assuring the confidentiality, authenticity and non-repudiability of electronic communications and data storage. They underpin various Internet standards, such as Transport Layer Security (TLS), S/MIME, PGP, and GPG. Some public key algorithms provide key distribution and secrecy (e.g., DiffieHellman key exchange), some provide digital signatures (e.g., Digital Signature Algorithm), and some provide both (e.g., RSA).

Before the mid 1970s, all cipher systems were using symmetric key algorithms, in which the same cryptographic key is used with the underlying algorithm by both the sender and the recipient, who must both keep it secret. Of necessity, the key in every such system had to be exchanged between the communicating parties in some secure way prior to any use of the system - a secure channel. This requirement is never trivial and very rapidly becomes unmanageable as the number of participants increases, or when secure channels aren't available for key exchange, or when, (as is sensible cryptographic practice), keys are frequently changed. In particular, if messages are meant to be secure from other users, a separate key is required for each possible pair of users.

By contrast, in a public key system, the public keys can be disseminated widely and openly - and only the private key needs to be kept secure by its owner.

Two of the best-known uses of public key cryptography are:

One important issue is confidence/proof that a particular public key is authentic, i.e. that it is correct and belongs to the person or entity claimed, and has not been tampered with or replaced by a malicious third party. There are several possible approaches, including:

A public key infrastructure (PKI), in which one or more third parties known as certificate authorities certify ownership of key pairs. TLS relies upon this.

A "web of trust" which decentralizes authentication by using individual endorsements of the link between user and public key. PGP uses this approach.

Lookup in the domain name system (DNS). The DKIM system for digitally signing emails uses this approach.

The most obvious application of a public key encryption system is in encrypting communication to provide confidentiality a message that a sender encrypts using the recipient's public key can be decrypted only by the recipient's paired private key.

Another application in public key cryptography is the digital signature. Digital signature schemes can be used for sender authentication.

Non-repudiation system use digital signatures to ensure that one party cannot successfully dispute its authorship of a document or communication.

Further applications built on this foundation include: digital cash, password-authenticated key agreement, time-stamping services, non-repudiation protocols, etc.

Because asymmetric key algorithms are nearly always much more computationally intensivethan symmetric ones, in many cases it is common to exchange a key using a key-exchange algorithm, then transmit data using that key and a symmetric key algorithm. PGP, SSH, and the SSL/TLS family of schemes use this procedure, and are thus called hybrid cryptosystems.

Like all security-related systems, it is important to identify potential weaknesses.

All public key schemes are in theory susceptible to a "brute-force key search attack".[citation needed] Such attacks are however impractical if the amount of computation needed to succeed termed the "work factor" by Claude Shannon is out of reach of all potential attackers. In many cases, the work factor can be increased by simply choosing a longer key. But other algorithms may have much lower work factors, making resistance to a brute-force attack irrelevant. Some special and specific algorithms have been developed to aid in attacking some public key encryption algorithms both RSA and ElGamal encryption have known attacks that are much faster than the brute-force approach.[citation needed]

Major weaknesses have been found for several formerly promising asymmetric key algorithms. The 'knapsack packing' algorithm was found to be insecure after the development of a new attack.[citation needed] Recently, some attacks based on careful measurements of the exact amount of time it takes known hardware to encrypt plain text have been used to simplify the search for likely decryption keys (see "side channel attack"). A great deal of active research is currently underway to both discover, and to protect against, new attack algorithms.

Another potential security vulnerability in using asymmetric keys is the possibility of a "man-in-the-middle" attack, in which the communication of public keys is intercepted by a third party (the "man in the middle") and then modified to provide different public keys instead. Encrypted messages and responses must also be intercepted, decrypted, and re-encrypted by the attacker using the correct public keys for different communication segments, in all instances, so as to avoid suspicion.

This attack may seem to be difficult to implement in practice, but it is not impossible when using insecure media (e.g., public networks, such as the Internet or wireless forms of communications) for example, a malicious staff member at Alice or Bob's Internet Service Provider (ISP) might find it quite easy to carry out. In the earlier postal analogy, Alice would have to have a way to make sure that the lock on the returned packet really belongs to Bob before she removes her lock and sends the packet back. Otherwise, the lock could have been put on the packet by a corrupt postal worker pretending to be Bob, so as to fool Alice.

One approach to prevent such attacks involves the use of a public key infrastructure (PKI); a set of roles, policies, and procedures needed to create, manage, distribute, use, store & revoke digital certificates and manage public-key encryption. However, this in turn has potential weaknesses.

For example, the certificate authority issuing the certificate must be trusted to have properly checked the identity of the key-holder, must ensure the correctness of the public key when it issues a certificate, must be secure from computer piracy, and must have made arrangements with all participants to check all their certificates before protected communications can begin. Web browsers, for instance, are supplied with a long list of "self-signed identity certificates" from PKI providers these are used to check the bona fides of the certificate authority and then, in a second step, the certificates of potential communicators. An attacker who could subvert any single one of those certificate authorities into issuing a certificate for a bogus public key could then mount a "man-in-the-middle" attack as easily as if the certificate scheme were not used at all. In an alternate scenario rarely discussed, an attacker who penetrated an authority's servers and obtained its store of certificates and keys (public and private) would be able to spoof, masquerade, decrypt, and forge transactions without limit.

Despite its theoretical and potential problems, this approach is widely used. Examples include TLS and its predecessor SSL, which are commonly used to provide security for web browser transactions (for example, to securely send credit card details to an online store).

Aside from the resistance to attack of a particular key pair, the security of the certification hierarchy must be considered when deploying public key systems. Some certificate authority usually a purpose-built program running on a server computer vouches for the identities assigned to specific private keys by producing a digital certificate. Public key digital certificates are typically valid for several years at a time, so the associated private keys must be held securely over that time. When a private key used for certificate creation higher in the PKI server hierarchy is compromised, or accidentally disclosed, then a "man-in-the-middle attack" is possible, making any subordinate certificate wholly insecure.

Examples of well-regarded asymmetric key techniques for varied purposes include:

Examples of asymmetric key algorithms not widely adopted include:

Examples of notable yet insecure asymmetric key algorithms include:

Examples of protocols using asymmetric key algorithms include:

During the early history of cryptography, two parties would rely upon a key that they would exchange by means of a secure, but non-cryptographic, method such as a face-to-face meeting or a trusted courier. This key, which both parties kept absolutely secret, could then be used to exchange encrypted messages. A number of significant practical difficulties arise with this approach to distributing keys.

In his 1874 book The Principles of Science, William Stanley Jevons[4] wrote:

Can the reader say what two numbers multiplied together will produce the number 8616460799?[5] I think it unlikely that anyone but myself will ever know.[6]

Here he described the relationship of one-way functions to cryptography, and went on to discuss specifically the factorization problem used to create a trapdoor function. In July 1996, mathematician Solomon W. Golomb said: "Jevons anticipated a key feature of the RSA Algorithm for public key cryptography, although he certainly did not invent the concept of public key cryptography."[7]

In 1970, James H. Ellis, a British cryptographer at the UK Government Communications Headquarters (GCHQ), conceived of the possibility of "non-secret encryption", (now called public key cryptography), but could see no way to implement it.[8] In 1973, his colleague Clifford Cocks implemented what has become known as the RSA encryption algorithm, giving a practical method of "non-secret encryption", and in 1974, another GCHQ mathematician and cryptographer, Malcolm J. Williamson, developed what is now known as DiffieHellman key exchange. The scheme was also passed to the USA's National Security Agency.[9] With a military focus and low computing power, the power of public key cryptography was unrealised in both organisations:

I judged it most important for military use ... if you can share your key rapidly and electronically, you have a major advantage over your opponent. Only at the end of the evolution from Berners-Lee designing an open internet architecture for CERN, its adaptation and adoption for the Arpanet ... did public key cryptography realise its full potential.

Ralph Benjamin[9]

Their discovery was not publicly acknowledged for 27 years, until the research was declassified by the British government in 1997.[10]

In 1976, an asymmetric key cryptosystem was published by Whitfield Diffie and Martin Hellman who, influenced by Ralph Merkle's work on public key distribution, disclosed a method of public key agreement. This method of key exchange, which uses exponentiation in a finite field, came to be known as DiffieHellman key exchange. This was the first published practical method for establishing a shared secret-key over an authenticated (but not confidential) communications channel without using a prior shared secret. Merkle's "public key-agreement technique" became known as Merkle's Puzzles, and was invented in 1974 and published in 1978.

In 1977, a generalization of Cocks' scheme was independently invented by Ron Rivest, Adi Shamir and Leonard Adleman, all then at MIT. The latter authors published their work in 1978, and the algorithm came to be known as RSA, from their initials. RSA uses exponentiation modulo a product of two very large primes, to encrypt and decrypt, performing both public key encryption and public key digital signature. Its security is connected to the extreme difficulty of factoring large integers, a problem for which there is no known efficient general technique.

Since the 1970s, a large number and variety of encryption, digital signature, key agreement, and other techniques have been developed in the field of public key cryptography, including the Rabin cryptosystem, ElGamal encryption, DSA - and elliptic curve cryptography.

See the rest here:
Public-key cryptography - Wikipedia

Cryptography dictionary definition | cryptography defined

The conversion of data into a secret code for transmission over a public network. Today, most cryptography is digital, and the original text ("plaintext") is turned into a coded equivalent called "ciphertext" via an encryption algorithm. The ciphertext is decrypted at the receiving end and turned back into plaintext.Keys Are the KeyThe encryption algorithm uses a "key," which is a binary number that is typically from 40 to 256 bits in length. The greater the number of bits in the key (cipher strength), the more possible key combinations and the longer it would take to break the code. The data are encrypted, or "locked," by combining the bits in the key mathematically with the data bits. At the receiving end, the key is used to "unlock" the code and restore the original data.

Secret Key Vs. Public Key

The secret method uses the same key to encrypt and decrypt. The problem is transmitting the key to the recipient in order to use it. The public key method uses two keys: one kept private and never transmitted, while the other is made public. Very often, the public key method is used to safely send the secret key to the recipient so that the message can be encrypted using the faster secret key algorithm.

Originally posted here:
Cryptography dictionary definition | cryptography defined

Guide to Cryptography – OWASP

Development Guide Table of Contents

To ensure that cryptography is safely used to protect the confidentiality and integrity of sensitive user data.

All.

DS5.18 Cryptographic key management

Initially confined to the realms of academia and the military, cryptography has become ubiquitous thanks to the Internet. Common every day uses of cryptography include mobile phones, passwords, SSL, smart cards, and DVDs. Cryptography has permeated everyday life, and is heavily used by many web applications.

Cryptography (or crypto) is one of the more advanced topics of information security, and one whose understanding requires the most schooling and experience. It is difficult to get right because there are many approaches to encryption, each with advantages and disadvantages that need to be thoroughly understood by web solution architects and developers. In addition, serious cryptography research is typically based in advanced mathematics and number theory, providing a serious barrier to entry.

The proper and accurate implementation of cryptography is extremely critical to its efficacy. A small mistake in configuration or coding will result in removing a large degree of the protection it affords and rending the crypto implementation useless against serious attacks.

A good understanding of crypto is required to be able to discern between solid products and snake oil. The inherent complexity of crypto makes it easy to fall for fantastic claims from vendors about their product. Typically, these are a breakthrough in cryptography or unbreakable or provide "military grade" security. If a vendor says "trust us, we have had experts look at this, chances are they weren't experts!

Cryptographic systems can provide one or more of the following four services. It is important to distinguish between these, as some algorithms are more suited to particular tasks, but not to others.

When analyzing your requirements and risks, you need to decide which of these four functions should be used to protect your data.

Using a cryptographic system, we can establish the identity of a remote user (or system). A typical example is the SSL certificate of a web server providing proof to the user that he or she is connected to the correct server.

The identity is not of the user, but of the cryptographic key of the user. Having a less secure key lowers the trust we can place on the identity.

The concept of non-repudiation is particularly important for financial or e-commerce applications. Often, cryptographic tools are required to prove that a unique user has made a transaction request. It must not be possible for the user to refute his or her actions.

For example, a customer may request a transfer of money from her account to be paid to another account. Later, she claims never to have made the request and demands the money be refunded to the account. If we have non-repudiation through cryptography, we can prove usually through digitally signing the transaction request, that the user authorized the transaction.

More commonly, the biggest concern will be to keep information private. Cryptographic systems were originally developed to function in this capacity. Whether it be passwords sent during a log on process, or storing confidential medical records in a database, encryption can assure that only users who have access to the appropriate key will get access to the data.

We can use cryptography to provide a means to ensure data is not viewed or altered during storage or transmission. Cryptographic hashes for example, can safeguard data by providing a secure checksum.

Various types of cryptographic systems exist that have different strengths and weaknesses. Typically, they are divided into two classes; those that are strong, but slow to run and those that are quick, but less secure. Most often a combination of the two approaches is used (e.g.: SSL), whereby we establish the connection with a secure algorithm, and then if successful, encrypt the actual transmission with the weaker, but much faster algorithm.

Symmetric Cryptography is the most traditional form of cryptography. In a symmetric cryptosystem, the involved parties share a common secret (password, pass phrase, or key). Data is encrypted and decrypted using the same key. These algorithms tend to be comparatively fast, but they cannot be used unless the involved parties have already exchanged keys. Any party possessing a specific key can create encrypted messages using that key as well as decrypt any messages encrypted with the key. In systems involving a number of users who each need to set up independent, secure communication channels symmetric cryptosystems can have practical limitations due to the requirement to securely distribute and manage large numbers of keys.

Common examples of symmetric algorithms are DES, 3DES and AES. The 56-bit keys used in DES are short enough to be easily brute-forced by modern hardware and DES should no longer be used. Triple DES (or 3DES) uses the same algorithm, applied three times with different keys giving it an effective key length of 112 bits (due to an attack that reduces the strength to the work that would be involved). Due to the problems using the DES algorithm, the United States National Institute of Standards and Technology (NIST) hosted a selection process for a new algorithm. The winning algorithm was Rijndael and the associated cryptosystem is now known as the Advanced Encryption Standard or AES. It is advisable to use AES, as DES is deprecated.

Asymmetric algorithms use two keys, one to encrypt the data, and either key to decrypt. These inter-dependent keys are generated together. One is labeled the Public key and is distributed freely. The other is labeled the Private Key and must be kept hidden.

Often referred to as Public/Private Key Cryptography, these cryptosystems can provide a number of different functions depending on how they are used.

The most common usage of asymmetric cryptography is to send messages with a guarantee of confidentiality. If User A wanted to send a message to User B, User A would get access to User Bs publicly-available Public Key. The message is then encrypted with this key and sent to User B. Because of the cryptosystems property that messages encoded with the Public Key of User B can only be decrypted with User Bs Private Key, only User B can read the message.

Another usage scenario is one where User A wants to send User B a message and wants User B to have a guarantee that the message was sent by User A. In order to accomplish this, User A would encrypt the message with their Private Key. The message can then only be decrypted using User As Public Key. This guarantees that User A created the message Because they are then only entity who had access to the Private Key required to create a message that can be decrcrypted by User As Public Key. This is essentially a digital signature guaranteeing that the message was created by User A.

A Certificate Authority (CA), whose public certificates are installed with browsers or otherwise commonly available, may also digitally sign public keys or certificates. We can authenticate remote systems or users via a mutual trust of an issuing CA. We trust their root certificates, which in turn authenticate the public certificate presented by the server.

PGP and SSL are prime examples of a systems implementing asymmetric cryptography, using RSA or other algorithms.

Hash functions take some data of an arbitrary length (and possibly a key or password) and generate a fixed-length hash based on this input. Hash functions used in cryptography have the property that it is easy to calculate the hash, but difficult or impossible to re-generate the original input if only the hash value is known. In addition, hash functions useful for cryptography have the property that it is difficult to craft an initial input such that the hash will match a specific desired value.

MD5 and SHA-1 are common hashing algorithms used today. These algorithms are considered weak (see below) and are likely to be replaced after a process similar to the AES selection. New applications should consider using SHA-256 instead of these weaker algorithms.

Lastly, we have key exchange algorithms (such as Diffie-Hellman for SSL). These allow use to safely exchange encryption keys with an unknown party.

As modern cryptography relies on being computationally expensive to break, specific standards can be set for key sizes that will provide assurance that with todays technology and understanding, it will take too long to decrypt a message by attempting all possible keys.

Therefore, we need to ensure that both the algorithm and the key size are taken into account when selecting an algorithm.

Proprietary encryption algorithms are not to be trusted as they typically rely on security through obscurity and not sound mathematics. These algorithms should be avoided if possible.

Specific algorithms to avoid:

Cryptography is a constantly changing field. As new discoveries in cryptanalysis are made, older algorithms will be found unsafe. In addition, as computing power increases the feasibility of brute force attacks will render other cryptosystems or the use of certain key lengths unsafe. Standard bodies such as NIST should be monitored for future recommendations.

Specific applications, such as banking transaction systems, may have specific requirements for algorithms and key sizes.

Assuming you have chosen an open, standard algorithm, the following recommendations should be considered when reviewing algorithms:

Symmetric:

Asymmetric:

The difficulty of cracking a 2048 bit key compared to a 1024 bit key is far, far, far, more than the twice you might expect. Dont use excessive key sizes unless you know you need them. Bruce Schneier in 2002 (see the references section) recommended the following key lengths for circa 2005 threats:

Hashes:

NIST and other standards bodies will provide up to date guidance on suggested key sizes.

Design your application to cope with new hashes and algorithms

As highlighted above, crypto relies on keys to assure a users identity, provide confidentiality and integrity as well as non-repudiation. It is vital that the keys are adequately protected. Should a key be compromised, it can no longer be trusted.

Any system that has been compromised in any way should have all its cryptographic keys replaced.

Unless you are using hardware cryptographic devices, your keys will most likely be stored as binary files on the system providing the encryption.

Can you export the private key or certificate from the store?

Storage of keys in hardware crypto devices is beyond the scope of this document. If you require this level of security, you should really be consulting with crypto specialists.

In security, we assess the level of trust we have in information. When applied to transmission of sensitive data, we need to ensure that encryption occurs before we transmit the data onto any untrusted network.

In practical terms, this means we should aim to encrypt as close to the source of the data as possible.

This can be extremely difficult without expert help. We can try to at least eliminate the most common problems:

We have the possibility to encrypt or otherwise protect data at different levels. Choosing the right place for this to occur can involve looking at both security as well as resource requirements.

Application: at this level, the actual application performs the encryption or other crypto function. This is the most desirable, but can place additional strain on resources and create unmanageable complexity. Encryption would be performed typically through an API such as the OpenSSL toolkit (www.openssl.com) or operating system provided crypto functions.

An example would be an S/MIME encrypted email, which is transmitted as encoded text within a standard email. No changes to intermediate email hosts are necessary to transmit the message because we do not require a change to the protocol itself.

Protocol: at this layer, the protocol provides the encryption service. Most commonly, this is seen in HTTPS, using SSL encryption to protect sensitive web traffic. The application no longer needs to implement secure connectivity. However, this does not mean the application has a free ride. SSL requires careful attention when used for mutual (client-side) authentication, as there are two different session keys, one for each direction. Each should be verified before transmitting sensitive data.

Attackers and penetration testers love SSL to hide malicious requests (such as injection attacks for example). Content scanners are most likely unable to decode the SSL connection, letting it pass to the vulnerable web server.

Network: below the protocol layer, we can use technologies such as Virtual Private Networks (VPN) to protect data. This has many incarnations, the most popular being IPsec (Internet Protocol v6 Security), typically implemented as a protected tunnel between two gateway routers. Neither the application nor the protocol needs to be crypto aware all traffic is encrypted regardless.

Possible issues at this level are computational and bandwidth overheads on network devices.

Todays web servers typically deal with large numbers of users. Differentiating between them is often done through cookies or other session identifiers. If these session identifiers use a predictable sequence, an attacker need only generate a value in the sequence in order to present a seemingly valid session token.

This can occur at a number of places; the network level for TCP sequence numbers, or right through to the application layer with cookies used as authenticating tokens.

Any deterministic sequence generator is likely to be vulnerable.

The only way to generate secure authentication tokens is to ensure there is no way to predict their sequence. In other words: true random numbers.

It could be argued that computers can not generate true random numbers, but using new techniques such as reading mouse movements and key strokes to improve entropy has significantly increased the randomness of random number generators. It is critical that you do not try to implement this on your own; use of existing, proven implementations is highly desirable.

Most operating systems include functions to generate random numbers that can be called from almost any programming language.

Windows & .NET: On Microsoft platforms including .NET, it is recommended to use the inbuilt CryptGenRandom function (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/cryptgenrandom.asp.

Unix: For all Unix based platforms, OpenSSL is an excellent option (http://www.openssl.org/). It features tools and API functions to generate random numbers. On some platforms, /dev/urandom is a suitable source of pseudo-random entropy.

PHP: mt_rand() uses a Mersenne Twister, but is nowhere near as good as CryptoAPIs secure random number generation options, OpenSSL, or /dev/urandom which is available on many Unix variants. mt_rand() has been noted to produce the same number on some platforms test prior to deployment. Do not use rand() as it is very weak.

Java: java.security.SecureRandom within the Java Cryptography Extension (JCE) provides secure random numbers. This should be used in preference to other random number generators.

ColdFusion: ColdFusion MX 7 leverages the JCE java.security.SecureRandom class of the underlying JVM as its pseudo random number generator (PRNG).

UUIDs (such as GUIDs and so on) are only unique if you generate them. This seems relatively straightforward. However, there are many code snippets available that contain existing UUIDS.

Cryptography is one of pillars of information security. Its usage and propagation has exploded due to the Internet and it is now included in most areas computing. Crypto can be used for:

A web application can implement cryptography at multiple layers: application, application server or runtime (such as .NET), operating system and hardware. Selecting an optimal approach requires a good understanding of application requirements, the areas of risk, and the level of security strength it might require, flexibility, cost, etc.

Although cryptography is not a panacea, the majority of security breaches do not come from brute force computation but from exploiting mistakes in implementation. The strength of a cryptographic system is measured in key length. Using a large key length and then storing the unprotected keys on the same server eliminates most of the protection benefit gained. Besides the secure storage of keys, another classic mistake is engineering custom cryptographic algorithms (to generate random session ids for example). Many web applications were successfully attacked because the developers thought they could create their crypto functions.

Our recommendation is to use proven products, tools, or packages rather than rolling your own.

http://eprint.iacr.org/2005/007.pdf

http://seclists.org/bugtraq/1999/Dec/208

http://www.schneier.com/crypto-gram-0204.html#3

http://www.schneier.com/crypto-gram.html

http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html

http://blogs.msdn.com/larryosterman/archive/2005/07/21/441417.aspx

http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx

The following section describes ColdFusions cryptography features. ColdFusion MX leverages the Java Cryptography Extension (JCE) of the underlying J2EE platform for cryptography and random number generation. It provides functions for symmetric (or private-key) encryption. While it does not provide native functionality for public-key (asymmetric) encryption, it does use the Java Secure Socket Extension (JSSE) for SSL communication.

Pseudo-Random Number Generation

ColdFusion provides three functions for random number generation: rand(), randomize(), and randRange(). Function descriptions and syntax:

Rand Use to generate a pseudo-random number

rand([algorithm])

Randomize Use to seed the pseudo-random number generator (PRNG) with an integer.

randomize(number [, algorithm])

RandRange Use to generate a pseudo-random integer within the range of the specified numbers

randrange(number1, number2 [, algorithm])

The following values are the allowed algorithm parameters:

CFMX_COMPAT: (default) Invokes java.util.rand

SHA1PRNG: (recommended) Invokes java.security.SecureRandom using the Sun Java SHA-1 PRNG algorithm.

IBMSecureRandom: IBM WebSpheres JVM does not support the SHA1PRNG algorithm.

Symmetric Encryption

ColdFusion MX 7 provides six encryption functions: decrypt(), decryptBinary(), encrypt(), encryptBinary(), generateSecretKey(), and hash(). Function descriptions and syntax:

Decrypt Use to decrypt encrypted strings with specified key, algorithm, encoding, initialization vector or salt, and iterations

decrypt(encrypted_string, key[, algorithm[, encoding[, IVorSalt[, iterations]]]]))

DecryptBinary Use to decrypt encrypted binary data with specified key, algorithm, initialization vector or salt, and iterations

decryptBinary(bytes, key[, algorithm[, IVorSalt[, iterations]]])

Encrypt Use to encrypt string using specific algorithm, encoding, initialization vector or salt, and iterations

encrypt(string, key[, algorithm[, encoding[, IVorSalt[, iterations]]]]))

Read the original:
Guide to Cryptography - OWASP

The State of Cryptography in PHP – Paragon Initiative …

With the release date for PHP 7 drawing near, let's take a look at everything good and bad about developing cryptography features in PHP, what got fixed in PHP 7, and what remains to be fixed in a future version of PHP.

The PHP programming language has come a long way throughout the lifetime of PHP 5. In the beginning, you had to implement your own ciphers and CSPRNG interfaces or install a PHP extension to offer basic security. As the language matured, it has become easier to implement secure cryptographic protocols without writing your own low-level features.

PHP 5 has several CSPRNG interfaces, but it's not immediately clear which one should be used (or even can):

To make things clear, simple, and unambiguous, PHP 7 ships with two simple functions powered by your operating system's CSRPNG.

If you'd like to give these new functions a whirl and don't have PHP 7 installed yet, Paragon Initiative Enterprises maintains a polyfill for PHP 5 projects called random_compat.

We've previously covered common uses for CSPRNGs if you need a starting point.

The PHP bindings for the Sodium cryptography library has finally reached the stable channel in PECL. To help developers get acclimated with this library, we wrote an online book about libsodium development in PHP. You can read it for free online; downloadable copies are coming soon.

There have been great leaps and bounds in the maturity of the PHP programming language, especially when it comes to cryptography features. With PHP 7.0 arriving in the coming months, we've been thinking about what we could build to make PHP 7.1 or 8.0 continue this momentum.

It's great that the PHP bindings for libsodium can be installed via pecl install libsodium (assuming you already installed the underlying library), but in future versions of PHP it would be even better if it were bundled with the rest of the language.

Three reasons:

Our Chief Development Officer has opened an RFC to add libsodium to PHP.

One of the initiatives our team has been leading is the development of a simple cryptography frontend for 7.1. Our idea is to make the interface simple and backend-agnostic (like PDO rather than MySQLi). The current draft will support OpenSSL and Libsodium and only allow authenticated encryption (Encrypt then MAC) or AEAD constructions.

The development of a prototype is currently being discussed and conducted at paragonie/pco_prototype. Everyone is welcome to join this discussion.

Although our Chief Development Officer previously opened a feature request on the PHP bug tracker for new hash functions in PHP 7, this did not get discussed in time for inclusion in 7.0. We would instead like to make it happen in PHP 7.1.

Later versions of PHP (7.1, maybe 7.2) should be updated so that password_hash() and password_verify() supports Argon2, the winner of the Password Hashing Competition. Whether or not this will be the new PASSWORD_DEFAULT algorithm remains to be decided.

Note that Argon2 is already being added to libsodium.

PHP has come a long way, and it has a long road ahead of it. Whatever challenges or opportunities await us, the development team at Paragon Initiative Enterprises will continue to do everything we can to make security as easy as PIE for software developers the world over.

Excerpt from:
The State of Cryptography in PHP - Paragon Initiative ...

The Code Book: The Science of Secrecy from Ancient Egypt …

People love secrets. Ever since the first word was written, humans have sent coded messages to each other. In The Code Book, Simon Singh, author of the bestselling Fermat's Enigma, offers a peek into the world of cryptography and codes, from ancient texts through computer encryption. Singh's compelling history is woven through with stories of how codes and ciphers have played a vital role in warfare, politics, and royal intrigue. The major theme of The Code Book is what Singh calls "the ongoing evolutionary battle between codemakers and codebreakers," never more clear than in the chapters devoted to World WarII. Cryptography came of age during that conflict, as secret communications became critical to both sides' success.

In the information age, the fear that drives cryptographic improvements is both capitalistic and libertarian--corporations need encryption to ensure that their secrets don't fall into the hands of competitors and regulators, and ordinary people need encryption to keep their everyday communications private in a free society. Similarly, the battles for greater decryption power come from said competitors and governments wary of insurrection.

The Code Book is an excellent primer for those wishing to understand how the human need for privacy has manifested itself through cryptography. Singh's accessible style and clear explanations of complex algorithms cut through the arcane mathematical details without oversimplifying. --Therese Littleton

See more here:
The Code Book: The Science of Secrecy from Ancient Egypt ...

What is Cryptography? – Invest In Blockchain

When researching cryptocurrencies, youve most likely come across the term cryptography. You might think cryptography is connected to cryptocurrencies in some way, and you would be correct.

However, cryptography is used for far more applications, such as data protection, ATMs, computer passwords, and much more. In this article, we walk you through the basics of cryptography and discuss its role in cryptocurrencies.

Cryptography is a method of hiding information to keep its content safe and secret. To uncover the information, the reader needs to know how the information has been modified, or encrypted. The encrypted message can, if properly done, be read only by the sender and the recipient.

Cryptography is far from new and has been around for thousands of years. Historically, cryptography was used to send important messages which were only meant for a select set of eyes. The first cryptographic messages were found on ancient Egyptians sites, but the first evidence for cryptography being used strategically dates back to the Roman era.

According to historians, Julius Caesar used cryptography, developing his so-called Caesar Cipher to send secret messages to his highest-ranking generals. This method of sheltering sensitive information from unwanted eyes has been used up until the modern era.

During World War II, the Germans used an encryption machine called the Enigma Machine to send important information to their ranks. As with most cryptography, there was a way to crack it, which was discovered by Alan Turing (mathematical genius and namesake of the Turing Test), now seen by some as one of the most decisive turning points in WWII.

The abovementioned Caesar Cipher, or the shift cipher, is one of the simplest ways of encrypting a message and understanding cryptography. It is also called a shift cipher because it substitutes the original letters of a message with other letters by shifting up or down in the alphabet.

For instance, if we encrypt the message with +3, A would become D, and K would become N. Reversely, with a rule of -2, D would become B and Z would become X.

read everything on invest in blockchain

uhdg hyhubwklqj rq lqyhvw lq eorfnfkdlq

Even though this is one of the simplest cryptographic methods, the logic behind it is basically the same for each method. There is a message which is secret to everyone but the concerned parties, and a process to make this message unreadable for everyone except for those in the know. This process is the encryption, and it has two elements:

The Cipher This is the set of rules that youre using to encode the information. For example, shifting the alphabet an X number of letters like in the Caesar Cipher. The cipher doesnt necessarily have to be a secret, because you will only be able to read it if you have access to the key.

The Key This tells you how to arrange the set of rules of the cipher. For the Caesar Cipher, this would the the number of letters the cipher would alphabetically shift, such as +3 or -2. The key is the tool used for deciphering a message.

So a lot of people can have access to the same cipher, but without the key they are still unable to crack it.

The process for the transfer of a secret message goes as following:

Encrypted messages are encrypted to protect their content, which implies that there will always be parties interested in obtaining that information. However, as people have tried and succeeded in cracking various codes, cryptography has been forced to adapt. It has moved far beyond just shifting letters in the alphabet, evolving into extremely complex puzzles that are increasingly harder to solve. Instead of shifting a few letters in the alphabet, letters are now changed to numbers, other letters and symbols based on hundreds or thousands of intermediary steps.

The computer era led to an exponential increase in the difficulty of encryptions. This is because computers brought with them a drastic increase in computational power. The human brain is still by far the most complex computer around, but when it comes to doing calculations, computers are much faster and can handle far larger computations.

The cryptography of the digital era entails electrical engineering, computer science, and mathematics. Messages are now generally encrypted and decrypted using highly complex algorithms created by a combination of these technologies. However, no matter how strong the encryption, there will always be people working to crack it.

You can see that even without the key, a Caesar Cipher isnt too hard to crack. Every letter can only take on 25 different values, and for most of the values the message will not make sense. By means of trial and error, you would be able to decipher the message without too much effort.

Cracking an encryption by trying all possibilities is known as brute force. It means trying all possibilities until a solution fits. With an increase in computing power, this becomes a more realistic threat which can only be tackled by increasing the complexity of the encryption. The more possible keys there are to a cipher, the more difficult it becomes to brute force your way to the message.

Current advanced ciphers allow for trillions of possible keys, making brute force less of a threat. However, it has been argued that supercomputers, and especially quantum computers, will soon be able to crack most encryptions through brute force because of their unmatched computational power.

As said, deciphering messages is becoming harder and harder, but its not impossible. This is because a cipher is inherently bound to a set of rules. The rules can be analyzed and give way to a more subtle way for decrypting a message: frequency analysis.

With the enormous increase in the complexity of ciphers, this can only be done through computers nowadays, but it can still be done. This technique analyzes recurring events and tries to find the key through this method.

Lets use the Caesar Cipher example again to explain this. We know that the letter E is far more frequently used than other letters in the alphabet. When we apply this knowledge to a Caesar-encrypted message, were going to look for the letter that shows up most. We find that the letter H is used more often than others and test this assumption by applying a -3 shift to the message. The longer a message becomes, the easier frequency analysis becomes.

uhdg hyhubwklqj rq lqyhvw lq eorfnfkdlq

Most cryptocurrencies serve completely different purposes than sending secret messages, but cryptography still plays a key role. It has turned out that the traditional principles of cryptography and the tools used for it actually have more functions than we previously thought.

The most important newly discovered functions are hashing and digital signatures.

Hashing is a cryptographic method for transforming large amounts of data into short numbers that are difficult to imitate. It is a key component of blockchain technology and is mainly concerned with the protection and integrity of the data flowing through the blockchain.

This method is mainly used for four processes:

A digital signature, similar to your own signature, is used to verify that you are who you say you are. When it comes to cryptocurrencies, digital signatures are mathematical functions that are matched to a specific wallet.

Thus, they function as proof that a specific wallet is actually the wallet it claims to be essentially, its a digital identification of a wallet. By attaching a digital signature to a transaction, no one can dispute that that transaction came from the wallet it purports to have come from, and that wallet cant be impersonated by another wallet.

Digital signatures use cryptography for wallet identification and secretly match the public and private key of a wallet. Your public key is basically your bank account number, while your private key is the pincode. It doesnt matter if people know your bank account, because the only thing they can do with it is deposit money to your account. However, if they know your pincode too, you can have a real problem.

In blockchain, the private key is used for the encryption of transactions, while the public key is used for the decryption. This is possible because the sending party is the one responsible for a transaction. The sending party encrypts the transaction with their private key, but this can be decrypted with the recipients public key because they only need to verify that it was indeed you who sent the message. If the sending partys public key doesnt work to decrypt the transaction, then the transaction isnt from that wallet.

In this system, the public key is distributed freely and is paired secretly to a private key. It is not a problem if a public key is known, but the private key must always be kept a secret. Even though the two are paired, calculating someones private key based on their public key is computationally so challenging that its financially and technically infeasible.

Protecting the key is a main disadvantage of this method. If others learn your private key, they can access your wallet and make transactions with it, which actually happened in the Bloomberg blunder when a reported accidentally showed his private key on TV.

Related: How to Secure Your Cryptocurrencies

The cryptography that is used for blockchain technology has a lot of different layers to it. This article explores the basics of cryptography and its usage for blockchains, but there is much more technical depth to it. On this website you can learn everything there is to cryptography, for free! If you are more interested in an in-depth overview of the specific cryptographic methods used in blockchain technology, this article can be very helpful to start with.

Whats important to understand about the relationship between cryptography and blockchain technology is the protection and security cryptography provides. It allows for a trustless system in which parties do not have to trust each other because they can place their trust in the cryptographic methods used.

Since the emergence of Bitcoin in 2009, cryptographic protection of the blockchain has withstood all attempts at data-tampering, and there have been many. Moreover, new cryptocurrencies are implementing even more secure methods of cryptography, some of which are already quantum-proof and thus protected from potential future threats.

Without cryptography, there could be no Bitcoin and no cryptocurrency, period. Amazingly, its a scientific method invented thousands of years ago that keeps our digital assets safe and secure.

Here is the original post:
What is Cryptography? - Invest In Blockchain

Cryptography: The Science of Making and Breaking Codes

There are lots of different ways to encrypt a message, from early, simple ciphers to the famous Enigma machine. But its tough to make a code truly unbreakable.

Hosted by: Michael Aranda----------Dooblydoo thanks go to the following Patreon supporters -- we couldn't make SciShow without them! Shout out to Justin Ove, John Szymakowski, Fatima Iqbal, Justin Lentz, David Campos, and Chris Peters.----------Like SciShow? Want to help support us, and also get things to put on your walls, cover your torso and hold your liquids? Check out our awesome products over at DFTBA Records: http://dftba.com/scishow

Or help support us by becoming our patron on Patreon:https://www.patreon.com/scishow----------Looking for SciShow elsewhere on the internet?Facebook: http://www.facebook.com/scishowTwitter: http://www.twitter.com/scishowTumblr: http://scishow.tumblr.comInstagram: http://instagram.com/thescishow

Sources:http://www.vectorsite.net/ttcode_04.h...http://www.simonsingh.net/The_Black_C...http://book.itep.ru/depository/crypto...http://www.cs.trincoll.edu/~crypto/hi...http://www.sans.org/reading-room/whit...http://ftp.stmarys-ca.edu/jsauerbe/m1...http://www.turing.org.uk/scrapbook/ww...http://enigma.louisedade.co.uk/howitw...http://www.codesandciphers.org.uk/eni...http://www.pbs.org/wgbh/nova/military...http://www.cs.miami.edu/~burt/learnin...

View post:
Cryptography: The Science of Making and Breaking Codes