cryptography

Reading data from European DTCO company card

给你一囗甜甜゛ 提交于 2020-03-20 06:46:20
问题 I need to be able to read card and company identification data from European digital tachograph company cards (smart cards). These are described within the document COMMISSION REGULATION (EC) No 1360/2002 but I have run into a problem. The data I need to be able to read is contained within the file EF Identification , which must be read with secure messaging and I therefore need to issue a Manage Secure Environment APDU command that requires a key identifier that identifies a key residing on

How to retrieve the Signature hash algorithm friendly name using c# cryptography?

冷暖自知 提交于 2020-03-19 06:29:00
问题 The following function uses a certificate to sign and verify. private static bool Sign_Verify(X509Certificate2 x509, byte[] random_data) { // // Local variable definitions // bool isVerified = false; byte[] buffer = Encoding.Default.GetBytes("Hello World ... !"); byte[] signature_Data = null; byte[] signature_Hash = null; // // Retrieve the private key of the certificate selected. // RSACryptoServiceProvider privateKey = x509.PrivateKey as RSACryptoServiceProvider; if (null == privateKey) {

How to get HMAC with Crypto Web API

岁酱吖の 提交于 2020-03-17 10:50:28
问题 How can I get HMAC-SHA512(key, data) in the browser using Crypto Web API ( window.crypto )? Currently I am using CryptoJS library and it is pretty simple: CryptoJS.HmacSHA512("myawesomedata", "mysecretkey").toString(); Result is 91c14b8d3bcd48be0488bfb8d96d52db6e5f07e5fc677ced2c12916dc87580961f422f9543c786eebfb5797bc3febf796b929efac5c83b4ec69228927f21a03a . I want to get rid of extra dependencies and start using Crypto Web API instead. How can I get the same result with it? 回答1: Answering my

How to get HMAC with Crypto Web API

一世执手 提交于 2020-03-17 10:49:38
问题 How can I get HMAC-SHA512(key, data) in the browser using Crypto Web API ( window.crypto )? Currently I am using CryptoJS library and it is pretty simple: CryptoJS.HmacSHA512("myawesomedata", "mysecretkey").toString(); Result is 91c14b8d3bcd48be0488bfb8d96d52db6e5f07e5fc677ced2c12916dc87580961f422f9543c786eebfb5797bc3febf796b929efac5c83b4ec69228927f21a03a . I want to get rid of extra dependencies and start using Crypto Web API instead. How can I get the same result with it? 回答1: Answering my

What pool of characters do MD5 and SHA have?

时光怂恿深爱的人放手 提交于 2020-03-17 10:02:20
问题 Does MD5 and SHA only contain alphanumeric characters? (i.e., from A to Z and 0 to 9, or do they exclude some characters?) 回答1: MD5 and SHA hashes in raw form are binary, however their common representation is a hex-encoded string, which contains characters [a-fA-F0-9] . So if this is what you meant, then characters G-Z, g-z are "excluded". Another, less common, representation is Base64 encoding [0-9a-zA-Z+/]. 来源: https://stackoverflow.com/questions/12618321/what-pool-of-characters-do-md5-and

Cryptograhically random unique strings

北战南征 提交于 2020-03-14 18:30:28
问题 In this answer, the below code was posted for creating unique random alphanumeric strings. Could someone clarify for me how exactly they are ensured to be unique in this code and to what extent these are unique? If I rerun this method on different occasions would I still get unique strings? Or did I just misunderstand the reply and these are not generating unique keys at all, only random? I already asked this in a comment to that answer but the user seems to be inactive. public static string

Cryptograhically random unique strings

半城伤御伤魂 提交于 2020-03-14 18:26:54
问题 In this answer, the below code was posted for creating unique random alphanumeric strings. Could someone clarify for me how exactly they are ensured to be unique in this code and to what extent these are unique? If I rerun this method on different occasions would I still get unique strings? Or did I just misunderstand the reply and these are not generating unique keys at all, only random? I already asked this in a comment to that answer but the user seems to be inactive. public static string

How to generate PKCS8 key with PEM encode using AES-128-ECB Alg in OpenSSL

给你一囗甜甜゛ 提交于 2020-03-06 02:15:19
问题 I want know How to generate below key [AES-128-ECB] using openssl cmd. -----BEGIN PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-ECB,379AB79E55059F9A gaakm48Y8qYA997fJREN4JtfVkfTdnVzaZK2 ...................................... gaakm48Y834748453273tfVkfTdnVzaZK2 .... -----END PRIVATE KEY----- From our internal code using below we have cretaed abv key , now I have to generate same format key using openssl cmd generated RSA Key then convert to PKCS8 then done PEM_encode using AES-128

Work with encrypted file and provide them with FileProvider

拟墨画扇 提交于 2020-03-05 03:32:26
问题 In my Android app, I need to expose some file from a FileProvider. Without encryption, it's quite easy: I simply add the FileProvider to manifest.xml . <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.provider" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/provider_paths" /> </provider> I need to receive some files, encrypt them (storing its

What is the output format of the SHA256withECDSA signature algorithm?

∥☆過路亽.° 提交于 2020-03-05 02:56:25
问题 I'm generating a key pair using the secp256k1 curve. Then I'm using the private key to sign a random String: byte[] content = "random string".getBytes(); Signature dsa = Signature.getInstance("SHA256withECDSA"); dsa.initSign(privateKey); dsa.update(content); byte[] signature = dsa.sign(); The signature byte array has the following content: [48, 68, 2, 32, 11, 25, 119, -64, -107, 53, -84, 65, -18, -81, -56, 34, 11, 29, 120, 38, -102, 105, -89, -9, -46, -28, 91, 59, -74, -103, -53, 117, 81, -37