How Alice will send an encrypted message to Bob using a common symmetric secret key?
Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. Cryptographic keys
In this articleThis article shows how to use standard key derivation functions to derive keys and how to encrypt content using symmetric and asymmetric keys. Symmetric keysSymmetric key encryption, also called secret key encryption, requires that the key used for encryption also be used for decryption. You can use a SymmetricKeyAlgorithmProvider class to specify a symmetric algorithm and create or import a key. You can use static methods on the CryptographicEngine class to encrypt and decrypt data by using the algorithm and key. Symmetric key encryption typically uses block ciphers and block cipher modes. A block cipher is a symmetric encryption function that operates on fixed size blocks. If the message you want to encrypt is longer than the block length, you must use a block cipher mode. A block cipher mode is a symmetric encryption function built by using a block cipher. It encrypts plaintext as a series of fixed size blocks. The following modes are supported for apps:
Some modes such as CBC require that you use an initialization vector (IV) for the first ciphertext block. The following are common initialization vectors. You specify the IV when calling CryptographicEngine.Encrypt. For most cases it is important that the IV never be reused with the same key.
Most modes require that the length of the plaintext be an exact multiple of the block size. This usually requires that you pad the plaintext to obtain the appropriate length. While block ciphers encrypt fixed size blocks of data, stream ciphers are symmetric encryption functions that combine plaintext bits with a pseudorandom bit stream (called a key stream) to generate the ciphertext. Some block cipher modes such as output feedback mode (OTF) and counter mode (CTR) effectively turn a block cipher into a stream cipher. Actual stream ciphers such as RC4, however, typically operate at higher speeds than block cipher modes are capable of achieving. The following example shows how to use the SymmetricKeyAlgorithmProvider class to create a symmetric key and use it to encrypt and decrypt data. Asymmetric keysAsymmetric key cryptography, also called public key cryptography, uses a public key and a private key to perform encryption and decryption. The keys are different but mathematically related. Typically the private key is kept secret and is used to decrypt data while the public key is distributed to interested parties and is used to encrypt data. Asymmetric cryptography is also useful for signing data. Because asymmetric cryptography is much slower than symmetric cryptography, it is seldom used to encrypt large amounts of data directly. Instead, it is typically used in the following manner to encrypt keys.
You can use an AsymmetricKeyAlgorithmProvider object to specify an asymmetric algorithm or a signing algorithm, to create or import an ephemeral key pair, or to import the public key portion of a key pair. Deriving keysIt is often necessary to derive additional keys from a shared secret. You can use the KeyDerivationAlgorithmProvider class and one of the following specialized methods in the KeyDerivationParameters class to derive keys.
FeedbackSubmit and view feedback for When Alice sends a message to Bob what key will she use to encrypt the message?When Bob wants to send a message to Alice he uses his copy of her public key to encrypt the message. Alice uses her securely-stored private key to perform the decryption.
Which key would you use to send an encrypted message to Bob?If Alice wants to send a secret message, M, to Bob she computes the Cipher Text by Encrypting with Bobs Public Key, and he will then Decrypt it with his Private Key.
Which type of crypto key can be used to encrypt a message from Alice to Bob where only Bob can be expected to decrypt it?Chapter 4: Public-Key Cryptography
Anyone with the public key can encrypt a message but not decrypt it. Only the person with the private key can decrypt the message. Using public-key cryptography, Alice and Bob can communicate securely using the following simple protocol: Alice and Bob agree on a public key algorithm.
What is the problem with Alice sending Bob a message by using her private key to encrypt it while Bob uses Alice's public key to decrypt it?Alice must've sent it, because only Alice can encrypt something that decrypts properly with Alice's public key.
|