Skip to content
  • ap@apple.com's avatar
    Implement RSASSA-PKCS1-v1_5 sign/verify · cbf00156
    ap@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=124335
    
    Reviewed by Sam Weinig.
    
    Source/WebCore:
    
    Test: crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html
    
    * WebCore.xcodeproj/project.pbxproj: Added new files, removed Mac SHA algorithm files.
    
    * crypto/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
    (WebCore::getCommonCryptoDigestAlgorithm):
    (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
    (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::verify):
    Implemented. These take two steps, first a digest is computed, and then it's signed.
    
    * crypto/CryptoDigest.h: Added.
    * crypto/mac/CryptoDigestMac.cpp: Added.
    (WebCore::CryptoDigest::CryptoDigest):
    (WebCore::CryptoDigest::~CryptoDigest):
    (WebCore::CryptoDigest::create):
    (WebCore::CryptoDigest::addBytes):
    (WebCore::CryptoDigest::computeHash):
    Added a cross-platform interface and Mac implementation to compute a digest. It
    should be possible to use it outside WebCrypto if we need to (perhaps even merge
    with  WTF SHA-1 class).
    The Mac implementation is kind of ugly, but at least it encapsulates the ugliness.
    
    * crypto/algorithms/CryptoAlgorithmSHA1.cpp: (WebCore::CryptoAlgorithmSHA1::digest):
    * crypto/algorithms/CryptoAlgorithmSHA224.cpp: (WebCore::CryptoAlgorithmSHA224::digest):
    * crypto/algorithms/CryptoAlgorithmSHA256.cpp: (WebCore::CryptoAlgorithmSHA256::digest):
    * crypto/algorithms/CryptoAlgorithmSHA384.cpp: (WebCore::CryptoAlgorithmSHA384::digest):
    * crypto/algorithms/CryptoAlgorithmSHA512.cpp: (WebCore::CryptoAlgorithmSHA512::digest):
    * crypto/mac/CryptoAlgorithmSHA1Mac.cpp: Removed.
    * crypto/mac/CryptoAlgorithmSHA224Mac.cpp: Removed.
    * crypto/mac/CryptoAlgorithmSHA256Mac.cpp: Removed.
    * crypto/mac/CryptoAlgorithmSHA384Mac.cpp: Removed.
    * crypto/mac/CryptoAlgorithmSHA512Mac.cpp: Removed.
    These are all cross-platform now.
    
    LayoutTests:
    
    * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify-expected.txt: Added.
    * crypto/subtle/rsassa-pkcs1-v1_5-sign-verify.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159292 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    cbf00156