dw.crypto
Class WeakSignature
Object
dw.crypto.WeakSignature
This API provides access to Deprecated algorithms.

See Signature for full documentation. WeakSignature is simply a drop-in replacement that only supports deprecated algorithms. This is helpful when you need to deal with weak algorithms for backward compatibility purposes, but Signature should always be used for new development and for anything intended to be secure.

This class allows access to signature services offered through the Java Cryptography Architecture (JCA). At this time the signature/verification implementation of the methods is based on the default RSA JCE provider of the JDK - sun.security.rsa.SunRsaSign

dw.crypto.WeakSignature is an adapter to the security provider implementation and only covers one digest algorithm:

  • SHA1withRSA

Note: this class handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, 12, and other relevant requirements.

Constructor Summary
Method Summary
isDigestAlgorithmSupported(digestAlgorithm : String) : boolean
Checks to see if a digest algorithm is supported
sign(contentToSign : String, privateKey : String, digestAlgorithm : String) : String
Signs a string and returns a string
sign(contentToSign : String, privateKey : KeyRef, digestAlgorithm : String) : String
Signs a string and returns a string
signBytes(contentToSign : Bytes, privateKey : String, digestAlgorithm : String) : Bytes
Signs bytes and returns bytes
signBytes(contentToSign : Bytes, privateKey : KeyRef, digestAlgorithm : String) : Bytes
Signs bytes and returns bytes
verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, publicKey : String, digestAlgorithm : String) : boolean
Verifies a signature supplied as bytes
verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, certificate : CertificateRef, digestAlgorithm : String) : boolean
Verifies a signature supplied as bytes
verifySignature(signature : String, contentToVerify : String, publicKey : String, digestAlgorithm : String) : boolean
Verifies a signature supplied as string
verifySignature(signature : String, contentToVerify : String, certificate : CertificateRef, digestAlgorithm : String) : boolean
Verifies a signature supplied as string
Constructor Detail
WeakSignature
public WeakSignature()

Salesforce Commerce Cloud Courses
Salesforce B2C Commerce Developer - Certification Tests
Why risk failing the SFCC exam? Get 180 real questions, killer content, and everything you need to crush the Salesforce B2C Commerce Developer certification.

Becoming a Salesforce B2C Commerce Developer is your ticket to higher salaries, better job opportunities, and the credibility to stand out from the competition. But let's be honestβ€”passing the certification exam isn't easy. That's where we come in.
Salesforce Javascript Developer I - Certification Tests
Not just another prep courseβ€”this is your shortcut to passing. Master JavaScript for Salesforce and go from 'hoping to pass' to knowing you will. Ready to start?

This isn't just another prep courseβ€”it's your shortcut to mastering the skills and confidence you need to pass. With multiple practice tests covering every section and a final exam simulation designed to mirror the real thing, you'll feel like you've already aced it before test day.
Salesforce B2C Commerce Architect - Certification Tests
Think the Developer exam was hard? Welcome to the next level.

The Salesforce B2C Commerce Architect certification is a whole different gameβ€”complex solutions, elevated difficulty, and skills that set you apart in the eCommerce industry. That's why we're including 11 downloadable PDF guides, packed with best practices and strategies to help you prepare for the exam and build confidence in every topic.
Method Detail
isDigestAlgorithmSupported
isDigestAlgorithmSupported(digestAlgorithm : String) : boolean
Checks to see if a digest algorithm is supported
Parameters:
digestAlgorithm - the digest algorithm name
Returns:
a boolean indicating success (true) or failure (false)

sign
sign(contentToSign : String, privateKey : String, digestAlgorithm : String) : String
Signs a string and returns a string
Parameters:
contentToSign - base64 encoded content to sign
privateKey - base64 encoded private key
digestAlgorithm - must be one of the currently supported ones
Returns:
the base64 encoded signature

sign
sign(contentToSign : String, privateKey : KeyRef, digestAlgorithm : String) : String
Signs a string and returns a string
Parameters:
contentToSign - base64 encoded content to sign
privateKey - a reference to a private key entry in the keystore
digestAlgorithm - must be one of the currently supported ones
Returns:
the base64 encoded signature

signBytes
signBytes(contentToSign : Bytes, privateKey : String, digestAlgorithm : String) : Bytes
Signs bytes and returns bytes
Parameters:
contentToSign - transformed with UTF-8 encoding into a byte stream
privateKey - base64 encoded private key
digestAlgorithm - must be one of the currently supported ones
Returns:
signature

signBytes
signBytes(contentToSign : Bytes, privateKey : KeyRef, digestAlgorithm : String) : Bytes
Signs bytes and returns bytes
Parameters:
contentToSign - transformed with UTF-8 encoding into a byte stream
privateKey - a reference to a private key entry in the keystore
digestAlgorithm - must be one of the currently supported ones
Returns:
signature

verifyBytesSignature
verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, publicKey : String, digestAlgorithm : String) : boolean
Verifies a signature supplied as bytes
Parameters:
signature - signature to check as bytes
contentToVerify - as bytes
publicKey - base64 encoded public key
digestAlgorithm - must be one of the currently supported ones
Returns:
a boolean indicating success (true) or failure (false)

verifyBytesSignature
verifyBytesSignature(signature : Bytes, contentToVerify : Bytes, certificate : CertificateRef, digestAlgorithm : String) : boolean
Verifies a signature supplied as bytes
Parameters:
signature - signature to check as bytes
contentToVerify - as bytes
certificate - a reference to a trusted certificate entry in the keystore
digestAlgorithm - must be one of the currently supported ones
Returns:
a boolean indicating success (true) or failure (false)

verifySignature
verifySignature(signature : String, contentToVerify : String, publicKey : String, digestAlgorithm : String) : boolean
Verifies a signature supplied as string
Parameters:
signature - base64 encoded signature
contentToVerify - base64 encoded content to verify
publicKey - base64 encoded public key
digestAlgorithm - must be one of the currently supported ones
Returns:
a boolean indicating success (true) or failure (false)

verifySignature
verifySignature(signature : String, contentToVerify : String, certificate : CertificateRef, digestAlgorithm : String) : boolean
Verifies a signature supplied as string
Parameters:
signature - base64 encoded signature
contentToVerify - base64 encoded content to verify
certificate - a reference to a trusted certificate entry in the keystore
digestAlgorithm - must be one of the currently supported ones
Returns:
a boolean indicating success (true) or failure (false)

β™₯
Notifications pending to read