From 39cf449ba7fa42ab654be0e7adb3b925a0afe201 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Fri, 19 Jun 2015 11:04:17 +0100 Subject: [PATCH] add some missing instance of HashAlgorithmASN1 --- Crypto/PubKey/RSA/PKCS15.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Crypto/PubKey/RSA/PKCS15.hs b/Crypto/PubKey/RSA/PKCS15.hs index dd37405..469248f 100644 --- a/Crypto/PubKey/RSA/PKCS15.hs +++ b/Crypto/PubKey/RSA/PKCS15.hs @@ -42,6 +42,8 @@ import qualified Crypto.Internal.ByteArray as B class HashAlgorithm hashAlg => HashAlgorithmASN1 hashAlg where hashDigestASN1 :: ByteArray out => Digest hashAlg -> out +-- http://uk.emc.com/emc-plus/rsa-labs/pkcs/files/h11300-wp-pkcs-1v2-2-rsa-cryptography-standard.pdf +-- EMSA-PKCS1-v1_5 instance HashAlgorithmASN1 MD2 where hashDigestASN1 = addDigestPrefix [0x30,0x20,0x30,0x0c,0x06,0x08,0x2a,0x86,0x48,0x86,0xf7,0x0d,0x02,0x02,0x05,0x00,0x04,0x10] instance HashAlgorithmASN1 MD5 where @@ -56,6 +58,10 @@ instance HashAlgorithmASN1 SHA384 where hashDigestASN1 = addDigestPrefix [0x30,0x41,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x02,0x05,0x00,0x04,0x30] instance HashAlgorithmASN1 SHA512 where hashDigestASN1 = addDigestPrefix [0x30,0x51,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x03,0x05,0x00,0x04,0x40] +instance HashAlgorithmASN1 SHA512t_224 where + hashDigestASN1 = addDigestPrefix [0x30,0x2d,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x05,0x05,0x00,0x04,0x1c] +instance HashAlgorithmASN1 SHA512t_256 where + hashDigestASN1 = addDigestPrefix [0x30,0x31,0x30,0x0d,0x06,0x09,0x60,0x86,0x48,0x01,0x65,0x03,0x04,0x02,0x06,0x05,0x00,0x04,0x20] instance HashAlgorithmASN1 RIPEMD160 where hashDigestASN1 = addDigestPrefix [0x30,0x21,0x30,0x09,0x06,0x05,0x2b,0x24,0x03,0x02,0x01,0x05,0x00,0x04,0x14]