FAQ Database Discussion Community


“Invalid use of a side-effecting operator 'OPEN SYMMETRIC KEY' within a function.” error while opening a symmetric key

sql-server,sql-server-2008,security,sql-server-2012,encryption-symmetric
I am trying to open symmetric key inside two functions. Like this: CREATE FUNCTION DECRYPTDATA ( @CipherText NVARCHAR(MAX) ) RETURNS NVARCHAR(MAX) AS BEGIN DECLARE @Result NVARCHAR(MAX) OPEN SYMMETRIC KEY MyKEY DECRYPTION BY CERTIFICATE MyCERT SELECT @Result = CONVERT(VARCHAR(MAX),DECRYPTBYKEY(@CipherText)) RETURN @Result END GO CREATE FUNCTION ENCRYPTDATA ( @Text NVARCHAR(MAX) ) RETURNS...

Migrating C# .Net encrypt/decrypt algorithm to Ruby

c#,ruby-on-rails,ruby,encryption,encryption-symmetric
I have to encrypt/decrypt data from a .Net based web service that is using the following code (based on Rijndael algorithm): /** * Cifra una cadena texto con el algoritmo de Rijndael * * @param plainMessage mensaje plano (sin cifrar) * @param p_strSpecialKey key especial * @return string texto cifrado...

Using ursa (nodejs module) to generate a symmetric key?

node.js,encryption,rsa,encryption-symmetric
I'm using ursa (nodejs module) to do the following: Use a private key and someone else's public key to generate a symmetric key Encrypt some data with the symmetric key Encrypt the symmetric key with the user's public key However, I can't seem to find any methods that allow me...

Symmetric and public key encryption

encryption,cryptography,key,encryption-symmetric,encryption-asymmetric
Suppose N people want to communicate with each of N- 1 other people using symmetric key encryption. All communication between any two people, i and j, is visible to all other people in this group of N, and no other person in this group should be able to decode their...

Why is it impossible to implement an “infinite” one time pad algorithm?

encryption,encryption-symmetric
I've done some research into this, but I'm still not sure why this cannot be implemented. Provided we share an initial OTP, possibly via USB or some other physically secure method, surely we can include the next one in the messages that follow. [Edit: More specifically, if I were to...

Fast, simple to use symmetric cipher for integer encryption in Java

java,encryption,encryption-symmetric
What is in Java a cipher function for integer encryption having these properties?: Fast Symmetric-key algorithm Simple to use (i.e. a couple of lines of code to use it and no external library to include) It is possible to specify the output length (e.g. 20 characters) I need to use...

Golang AES StreamReader encryption - Example omits any authentication of the encrypted data

encryption,go,aes,encryption-symmetric
Finally I am posting my first question on StackOverflow. I'm using this site for years now and I always found great answers to all my questions :) I am implementing a file encryption background daemon which is based on the official Golang cipher example: func ExampleStreamReader() { key := []byte("example...

Symmetric encryption issue between a .Net application and a Java application

java,.net,encryption,aes,encryption-symmetric
I am integrating with a .Net application which uses Symmetric encryption. My application is on Java. Following is the .Net code which was shared by the team which uses the Symmetric encryption; public static string SymmetricEncrypt<T>(string value, string PrivateKey, string SALT_STRING) where T : SymmetricAlgorithm, new() { PasswordDeriveBytes rgb =...

Android encryption and decryption of text fails

android,security,encryption,encryption-symmetric
I try to encrypt some text (here it is named code) and decrypt it again. For this i use a 4 digit Pin which is salted. After this the text is encrypted, also again some Base64 decoding, so i can safely output the String again. As i understand i have...

Where does SSL symmetric key is stored?

ssl,https,encryption-symmetric
This is what I understand for SSL communication. The browser gets public key from the web server of the secured website. The client and server establish session key based on public/private keys and then continue communication through symmetric algorithm during the SSL session. My questions: After session key is generated,...

How to protect a server's secret key on a browser?

javascript,cryptography,encryption-symmetric,webcryptoapi
In this use case, the server send an encypted blob to the browser and the the javascript on the browser subsequently requests the decryption key from the server and decrypts the blob to usable content. Is there a way to protect this key on the browser from an attack by...

NSIS unicode cypher plug-in

plugins,unicode,nsis,encryption-symmetric
Is there a NSIS unicode plug-in for symmetric encryption/decryption available? I tried Blowfish and NSISCrypt with Unicode true option. Blowfish doesn't seem to give any output whatsoever, and NSISCrypt gives some strange (I believe Chinese) characters, and can't even get decryption part to work without unicode enabled. Any advice?...

CCCrypt working with pieces of files AES CBC: garbage to end of files on encryption-decryption cycle

ios,swift,aes,encryption-symmetric
Although I was able to get data encryption and decryption (AES128CBC) working easily with CCCrypt based on some of the great examples of Zaph and others here, I have had two strange problems with CCCrypt when working with encrypting/decrypting files. 1) Upon encrypting and then decrypting a file, I am...

What type of encryption do I need?

encryption,aes,des,encryption-symmetric
Ok, the original task is to track users among 2 "friendly" web-sites who are able to share users cookies (lets say, I have example.com and my friend has mysite.com and also he has a domain simple.example.com so he can set cookies on .example.com). To track users activity we want to...

Symmetric Key Decryption returning values with space between characters

c#,asp.net,sql-server,sql-server-2012,encryption-symmetric
I am using following Scaler-valued function to decrypt data that is encrypted using a symmetric key: USE [DBNAME] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION [dbo].[DECRYPTDATA] ( @CipherText NVARCHAR(MAX) ) RETURNS NVARCHAR(MAX) AS BEGIN DECLARE @Result NVARCHAR(MAX) SELECT @Result = CONVERT(VARCHAR(MAX),DECRYPTBYKEY(@CipherText)) RETURN @Result END And I...

GCM authenticated encryption function for PHP

php,encryption,encryption-symmetric,aes-gcm
I need to run the following on a shared web hosting account running PHP engine Version 5.4.34. (I.e. I can't install any 3rd party libraries.) Is there a standard function to implement Galois/Counter Mode (GCM) authenticated encryption (of AES standard) on a binary string?...

Encryption between desktop app and server - C# to PHP

c#,php,encryption-symmetric,encryption-asymmetric
I have an app which is designed in C#. In simple terms the app sends data and image to my web server which takes all the $_POST data and processes it. I will confess i do not understand how the security end of things work. I will employ someone with...