cryptography

What actual algorithm is used by SecureRandom.getInstance(“DRBG”)?

筅森魡賤 提交于 2019-12-23 01:36:17
问题 Java 9 (JSR 379) introduces the NIST DRBG's as specified in JEP 273. However, the NIST document SP 800-90Ar1 (NIST Special Publication 800-90A Revision 1: Recommendation for Random Number Generation Using Deterministic Random Bit Generators) specifies a total of tree mechanisms: Implement the three DRBG mechanisms (Hash_DRBG, HMAC_DRBG, CTR_DRBG) in 800-90Ar1 (on all platforms). However, although you might expect that we would now have three methods to create such secure random algorithms:

AES-CTR Encrypt in Go and decrypt in CryptoJS

≯℡__Kan透↙ 提交于 2019-12-23 01:34:22
问题 I have a problem decrypting text, which is encrypted in Go lang, with CryptoJS. Here is Go code: https://play.golang.org/p/xCbl48T_iN package main import ( "crypto/aes" "crypto/cipher" "encoding/base64" "fmt" ) func main() { key := []byte("1234567890123456") plaintext := []byte("text can be a random lenght") block, err := aes.NewCipher(key) if err != nil { panic(err) } // The IV needs to be unique, but not secure. Therefore it's common to // include it at the beginning of the ciphertext. //

AES encrypt in c# decrypt in T-SQL

孤人 提交于 2019-12-23 01:34:12
问题 I have written the following code to decrypt some sensitive data, in most of the cases i need to query data using T-SQL where i can't decrypt the the data that is encrypted by this code. so my question is this how can i write a function in T-SQL that work the same way as like it work in C#, I will consume that in Stored procedures. thanks in Advance Encryption Function: public static string Encrypt(string text) { if (string.IsNullOrEmpty(EncryptionKey)) return string.Empty; if (string

Store symmetric keys in Java Card

独自空忆成欢 提交于 2019-12-23 01:24:22
问题 I am working on an applet which has to share some keys of type AESKey with different terminals. The thing is I don't know in advance how many terminals it will have to handle. As there is no structure like HashTable in Java Card, it's getting complicated. I can still fix an upper bound and instanciate as much objects AESKey but I would like to search for another way to do. I thought I could do something with byte arrays, but is it a bad practice to store keys in byte[] ? I think the answer is

encrypt in .net core with TripleDES

十年热恋 提交于 2019-12-22 17:57:20
问题 public static string Encrypt(string toEncrypt, string secretKey) { byte[] keyArray; byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(toEncrypt); var md5Serv = System.Security.Cryptography.MD5.Create(); keyArray = md5Serv.ComputeHash(UTF8Encoding.UTF8.GetBytes(secretKey)); md5Serv.Dispose(); var tdes = System.Security.Cryptography.TripleDES.Create(); //set the secret key for the tripleDES algorithm tdes.Key = keyArray; //mode of operation. there are other 4 modes. //We choose ECB(Electronic

DER encoding - How to convert implicit tag to explicit tag

可紊 提交于 2019-12-22 12:39:32
问题 I have an X.509 certificate that contains a set of data with the following IMPLICIT [0] tag: A0 81 C6 (value)... And I have this excerpt from a standards document: The IMPLICIT [0] tag is not used for the DER encoding, rather an EXPLICIT SET OF tag is used. That is, the DER encoding of the EXPLICIT SET OF tag, rather than of the IMPLICIT [0] tag, MUST be included along with the length and content octets of the value. I've done a lot of searching around, but I can't figure out exactly what the

How to sign xml element using RSA-SHA1 algorithm?

家住魔仙堡 提交于 2019-12-22 12:33:09
问题 I need to sign (and verify eventually) one of the nodes of an XML document using RSA-SHA1 algorithm. w3.org link RSA-SHA1 URI: http://www.w3.org/2000/09/xmldsig#rsa-sha1 Specified in: section 6.4.2 of [XMLDSIG-CORE2002] I am following this example, however cannot figure how to change the algorithm to required. The signature generation happens here: signedXml.ComputeSignature(); The only override with a parameter expects KeyedHashAlgorithm : public void ComputeSignature(KeyedHashAlgorithm

crypto++ RSA public key encryption with long plaintext

我们两清 提交于 2019-12-22 11:15:10
问题 i am trying to encrypt/decrypt some long text with RSA public/private key encryption using cryptopp. I found many examples including the official on http://www.cryptopp.com/wiki/RSA but all of the examples have one problem: They only allow me to encrypt data that is a bit shorter then the key size. So the question is: Do i really have to split the data and encrypt block for block myself, or does crypto++ already provide some functions to handle this (like GCM or CFB modes on AES encryption)?

Encrypted data size using RSA encryption (RSACryptoServiceProvider)

冷暖自知 提交于 2019-12-22 10:36:56
问题 I need to use some encryption mechanism in one of the project I am working on. I was exploring RSA encryption and wrote some sample programs to learn. I understand that block size of RSA encryption is 16 bytes. So I gave the string "12345678" as input to below function: public static string Encrypt (string input) { var byteConverter = new UnicodeEncoding (); RSACryptoServiceProvider cruptoEngine = new RSACryptoServiceProvider(); byte[] output = cruptoEngine.Encrypt (byteConverter.GetBytes

PHP implementing Ciphertext Stealing (CTS) with CBC

大兔子大兔子 提交于 2019-12-22 10:06:04
问题 I have been trying to implement Ciphertext Stealing(CTS) in PHP for CBC. Referring below two links How can I encrypt/decrypt data using AES CBC+CTS (ciphertext stealing) mode in PHP? and http://en.wikipedia.org/wiki/Ciphertext_stealing I am confused and stuck on the last and simplest step of XOR. I know this is silly but having tried all the combinations, i don't know what am i missing. Code follows. // 1. Decrypt the second to last ciphertext block, using zeros as IV. $second_to_last_cipher