shared-secret

Shared Secret is Nil when using CC.EC.computeSharedSecret from SwCrypt pod library iOS

不想你离开。 提交于 2020-06-17 09:55:10
问题 How to compute shared secret using EC public key x and y values and private key d value using the below function and I am getting back nil. I tried to decode and i can see the privateD which i am passing returns back nil from importKey method where the value of status is -4302 within the SwCrypt pod. Can you please help what format Data should i be passing into the computeSharedSecret for it to work in this case ? code var publicX = "2_v-MuNZccqwM7PXlakW9oHLP5XyrjMG1UVS8OxYrgA" var publicY =

Java: Base64 Encode a String using a key

隐身守侯 提交于 2020-02-02 23:43:07
问题 Hi I have data and a key (both strings). The data needs to be encode using the key using Base64. Can some one give me a sample code. 回答1: Base64 is not for 'encoding with a key'. It is simply a encoding scheme: you can use Base64 to encrypt and decrypt strings without any extra's. It's just for very (very) basic security usages. 回答2: you can xor the data with your key and then base64 encode it. var key = "mykey"; var mydata = "some long text here"; var output = ''; for (var i = 0, len =

Calculating an oauth signature

。_饼干妹妹 提交于 2020-01-02 15:26:50
问题 I am trying something a little specific, namely trying to call a REST API. I have been following these instructions. I have been very careful to ensure that I am creating the "Signature base string" correctly. They define it to be created like this: (HTTP Method)&(Request URL)&(Normalized Parameters) You can double check if need be in my code, but I am very sure that it is fine. The problem that I am having is creating what they call the "oauth signature" and mine isn't matching theirs. They

Shared Secret based on Elliptic curve Diffie–Hellman with CommonCrypto

一世执手 提交于 2019-12-12 11:07:42
问题 I am looking for the methods in CommonCrypto to generate the shared secret based on ECDH (Elliptic curve Diffie–Hellman). I can find proprietary implementations like this one https://github.com/surespot/surespot-ios/blob/master/surespot/encryption/EncryptionController.mm but this one is not using CommonCrypto. The method to calculate the shared secret is called sometimes Key Exchange and includes the calculation of the shared secret. Can someone send a link to the right documentation or to an

Connection to Azure Vault using MSI

有些话、适合烂在心里 提交于 2019-12-10 10:35:50
问题 I am trying to connect to my azure vault from a console application with using MSI For this vault i have added my user as the Selected Principle the code i am using to connect is var azureServiceTokenProvider = new AzureServiceTokenProvider(); var keyVaultClient = new KeyVaultClient(new KeyVaultClient.AuthenticationCallback(azureServiceTokenProvider.KeyVaultTokenCallback)); var secret = await keyVaultClient.GetSecretAsync("https://<vaultname>.vault.azure.net/secrets/<SecretName>")

Calculating an oauth signature

狂风中的少年 提交于 2019-12-06 16:01:19
I am trying something a little specific, namely trying to call a REST API. I have been following these instructions . I have been very careful to ensure that I am creating the "Signature base string" correctly. They define it to be created like this: (HTTP Method)&(Request URL)&(Normalized Parameters) You can double check if need be in my code, but I am very sure that it is fine. The problem that I am having is creating what they call the "oauth signature" and mine isn't matching theirs. They it should be created like this: Use the HMAC-SHA1 signature algorithm as defined by the [RFC2104] to

Java Implementation of Shamir's Secret Sharing

末鹿安然 提交于 2019-12-03 13:46:43
问题 I tryed to implement Shamir's Secret Sharing in Java but I have some problem. When I put K>10 the secret is no more reconstructed. Who can help me? This is what i've done. What's the problem? Initially I choose N and K, next I have the generation of coefficients, the creation of shares and finally the reconstruction. import java.math.BigInteger; import java.util.Random; public class Main { public static void main(String[] args){ //INIT int N = 55; int K = 11; BigInteger secret = new

Java Implementation of Shamir's Secret Sharing

末鹿安然 提交于 2019-12-03 03:39:00
I tryed to implement Shamir's Secret Sharing in Java but I have some problem. When I put K>10 the secret is no more reconstructed. Who can help me? This is what i've done. What's the problem? Initially I choose N and K, next I have the generation of coefficients, the creation of shares and finally the reconstruction. import java.math.BigInteger; import java.util.Random; public class Main { public static void main(String[] args){ //INIT int N = 55; int K = 11; BigInteger secret = new BigInteger("123"); modLength = secret.bitLength() + 1; BigInteger primeNum = genPrime(); BigInteger[] coeff =