Exemplo n.º 1
0
        private string DecryptToken(string encryptedConnectToken, AsymmetricCipherKeyPair keyPair)
        {
            // token was encoded as a urlsafe base64 so it can be transfered in a url
            byte[] cipherBytes = Conversion.UrlSafeBase64ToBytes(encryptedConnectToken);

            byte[] decipheredBytes = CryptoEngine.DecryptRsa(cipherBytes, keyPair);

            return(Conversion.BytesToUtf8(decipheredBytes));
        }
Exemplo n.º 2
0
        private byte[] UnwrapKey(string wrappedKey, AsymmetricCipherKeyPair keyPair)
        {
            byte[] cipherBytes = Conversion.Base64ToBytes(wrappedKey);

            return(CryptoEngine.DecryptRsa(cipherBytes, keyPair));
        }