sha256

C# Support for RSA SHA 256 signing for individual XML elements

冷暖自知 提交于 2019-12-03 22:14:20
问题 I have encountered a blocker with the .NET Framework version 4.5 to do with signing of XML with digital signatures. My problem is based around the need to sign individual XML elements with X.509 certificate with the RSA SHA-256 algorithm. I have read many .NET posts on this topic and it appears that there is a solution originally developed in the CLR Security project RSAPKCS1SHA256SignatureDescription.cs class. RSAPKCS1SHA256SignatureDescription has of course since been incorporated into the

hashing “SHA256” with two parameters

徘徊边缘 提交于 2019-12-03 21:51:02
I must convert a JAVA function that Hashing a string. this is a function: private static String hmacSha256(String value, String key) throws NoSuchAlgorithmException, InvalidKeyException { byte[] keyBytes = key.getBytes(); SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] rawHmac = mac.doFinal(value.getBytes()); return String.format("%0" + (rawHmac.length << 1) + "x", new BigInteger(1, rawHmac)); } My doubt is: this function take 2 parameters: String value: It is the string to crypt String Key: It is

Windows CryptoAPI: CryptSignHash with CALG_SHA_256 and private key from MY keystore

风格不统一 提交于 2019-12-03 21:03:08
I am trying to generate digital signatures on Windows (from XP SP3, but currently testing with Windows 7) with CryptoAPI that will be compatible with the following openssl commands: openssl dgst -sha256 -sign <parameters> (for signing) openssl dgst -sha256 -verify <parameters> (for validation) I want to use a private key from the Windows "MY" keystore for signing. I managed to sign files using the SHA1 digest algorithm by using the following CryptoAPI functions (omitting parameters for brevity): CertOpenStore CertFindCertificateInStore CryptAcquireCertificatePrivateKey CryptCreateHash (with

Convert a clientsecret into a private key

半腔热情 提交于 2019-12-03 20:32:25
I'm working with Google Cloud Storage in AppEngine and I'm attempting to use a POST form to upload a file to GCS. The problem I'm having is with the steps needed to sign the policy document. I can easily fetch the client_secret, which is a String from the client_secrets.json that the API Console gave me. however, in order to create a signature, I need to convert that string into a PrivateKey object. Here's what my code looks like: //create the policy document and encode it String policyDocument = ... //omitted for brevity String encodedPolicy = Base64.encodeString(policyDocument); //sign using

How to get Ruby generated HMAC for SHA256 that is url safe to match Java?

筅森魡賤 提交于 2019-12-03 19:56:26
问题 I have a tomcat server running some Java code that lets users authenticate using an API key. The request uses an HMAC created with SHA256. I have a Ruby client that I am using to make the request and since I'm new to encryption I am having a difficult time getting it to generate a matching HMAC. I have tried not making it URL safe, and that matches. So I'm really wondering is how I can get the Ruby client to match with the URL safe version (since I can't change the Java code). It's just got

What is better? Password_hash vs. SHA256 vs. SHA1 vs. md5

守給你的承諾、 提交于 2019-12-03 17:35:40
问题 What is better with salt for password storage? MD5: $hash = md5($password . $salt); Password_hash: $hash = password_hash($password, PASSWORD_DEFAULT, $salt); SHA1: $result = sha1($salt.$string); 回答1: You should absolutely use the password_hash() function without providing your own salt: $hash = password_hash($password, PASSWORD_DEFAULT); The function will generate a safe salt on its own. The other algorithms are ways too fast to hash passwords and therefore can be brute-forced too easily

How to use common crypto and/or calculate sha256 in swift 2 & 3

梦想的初衷 提交于 2019-12-03 16:36:59
问题 I am trying to make hash a password value according to sha256. I already search this but there is no info about swift 2. This solution did not worked for me func sha256(data:String) -> String { let data = self.dataUsingEncoding(NSUTF8StringEncoding)! var digest = [UInt8](count:Int(CC_SHA256_DIGEST_LENGTH), repeatedValue: 0) CC_SHA256(data.bytes, CC_LONG(data.length), &digest) let hexBytes = digest.map { String(format: "%02hhx", $0) } return hexBytes.joinWithSeparator("") } It gives error: Use

使用kubeadm添加node节点

情到浓时终转凉″ 提交于 2019-12-03 14:49:06
node节点服务器需要安装好 kubeadm, kubelet 和 kubectl: 使用kubeadm join 命令即行,使用master节点kebeadm init时的提示: root@boke-node:~# kubeadm join 192.168.17.180:6443 --token abcdef.0123456789abcdef \ > --discovery-token-ca-cert-hash sha256:ea37964dc96f76f3e658b27ffdc220f60ced82de387aafd8effafe9618f5e6cb [preflight] Running pre-flight checks [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/ [preflight] Reading configuration from the cluster... [preflight] FYI: You can look at this config

why PHP's hash_hmac('sha256') gives different result than java sha256_HMAC

对着背影说爱祢 提交于 2019-12-03 13:04:35
问题 in PHP I have the following function: base64_encode(hash_hmac('sha256', $data, $secret, false)); I'm trying to create a function in Java that will give the same result for the same "data" and "secret" parameters. I tried to use this function: public static String base64sha256(String data, String secret) { Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); sha256_HMAC.init(secret_key); byte[] res = sha256_HMAC.doFinal

Using HMAC SHA256 in Ruby

无人久伴 提交于 2019-12-03 12:53:44
问题 I'm trying to apply HMAC-SHA256 for generate a key for an Rest API. I'm doing something like this: def generateTransactionHash(stringToHash) key = '123' data = 'stringToHash' digest = OpenSSL::Digest.new('sha256') hmac = OpenSSL::HMAC.digest(digest, key, data) puts hmac end The output of this is always this: (if I put '12345' as parameter or 'HUSYED815X', I do get the same) ۯw/{o���p�T����:��a�h��E|q The API is not working because of this... Can some one help me with that? 回答1: According to