verify signature is not working

Comments

22 comments

  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thank you for reaching out.

    So the code looks fine to me. 

    Can you confirm the verify signature is returning false for every notification you receive? 

    Also, can you confirm you are retrieving the timestamp from the response headers?

    I'm looking forward to your response.

    Kind Regards,
    Thomas

     
    
    
    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    Yes I'm confirming that false is returning for every request for our costumer for wich I put the JSON.

     

    I'm reading the following headers:

    X-Cld-Signature
    X-Cld-Timestamp


    Alberto

     

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for confirming and apologies for back late.

    I'm looking further so I will update you asap.

    Please let me know if you have any other questions or queries.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for your patience.

    So it appears in the body, you are escaping the double quotes three times and this is most likely causing the signature mismatch.

    You should only need to escape the double quote once e.g.

    "{\"notification_type\":\"upload\",\"timestamp\":\"2022-09-05T12:40:29+00:00\",\"request_id\":\"b88ed9317f4d57df881cabe1c58e884a\",\"asset_id\":\"9061b752b50dd8fae02000cbc15562bc\",\"public_id\":\"test/seecommerce/original/202B0021T301-CE947-R\",\"version\":1662381623,\"version_id\":\"6cec0742c334ceb2891b791dc083681e\",\"width\":1571,\"height\":2000,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2022-07-07T08:27:16Z\",\"tags\":[],\"pages\":1,\"bytes\":1158806,\"type\":\"upload\",\"etag\":\"ca50260a15fd4b7c753429ff28766137\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1662381623/test/seecommerce/original/202B0021T301-CE947-R.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1662381623/test/seecommerce/original/202B0021T301-CE947-R.jpg\",\"folder\":\"test/seecommerce/original\",\"access_mode\":\"public\",\"faces\":[],\"image_metadata\":{\"CodedCharacterSet\":\"UTF8\",\"ApplicationRecordVersion\":\"4\",\"TimeCreated\":\"16:23:35+00:00\",\"DigitalCreationDate\":\"2020:06:29\",\"ImageWidth\":\"1571\",\"ImageHeight\":\"2000\",\"BitsPerSample\":\"8 8 8\",\"Compression\":\"LZW\",\"PhotometricInterpretation\":\"RGB\",\"Make\":\"Canon\",\"Model\":\"Canon EOS 5D Mark III\",\"Orientation\":\"Horizontal (normal)\",\"SamplesPerPixel\":\"3\",\"XResolution\":\"72\",\"YResolution\":\"72\",\"PlanarConfiguration\":\"Chunky\",\"ResolutionUnit\":\"inches\",\"Software\":\"Adobe Photoshop CS6 (Windows)\",\"ModifyDate\":\"2020:07:21 09:09:49\",\"ExposureTime\":\"1/125\",\"FNumber\":\"16.0\",\"ExposureProgram\":\"Manual\",\"ISO\":\"100\",\"SensitivityType\":\"Recommended Exposure Index\",\"RecommendedExposureIndex\":\"100\",\"ExifVersion\":\"0230\",\"DateTimeOriginal\":\"2020:06:29 16:23:35\",\"CreateDate\":\"2020:06:29 16:23:35\",\"ShutterSpeedValue\":\"1/125\",\"ApertureValue\":\"16.0\",\"ExposureCompensation\":\"0\",\"SubjectDistance\":\"0 m\",\"MeteringMode\":\"Multi-segment\",\"Flash\":\"Off, Did not fire\",\"FocalLength\":\"70.0 mm\",\"SubSecTimeOriginal\":\"60\",\"SubSecTimeDigitized\":\"60\",\"ColorSpace\":\"sRGB\",\"ExifImageWidth\":\"1571\",\"ExifImageHeight\":\"2000\",\"FocalPlaneXResolution\":\"3942.505127\",\"FocalPlaneYResolution\":\"3950.617188\",\"FocalPlaneResolutionUnit\":\"inches\",\"FileSource\":\"Digital Camera\",\"SceneType\":\"Directly photographed\",\"CustomRendered\":\"Normal\",\"ExposureMode\":\"Manual\",\"WhiteBalance\":\"Manual\",\"SceneCaptureType\":\"Standard\",\"SerialNumber\":\"083024003753\",\"LensInfo\":\"24-70mm f/?\",\"LensModel\":\"Canon EF 24-70mm f/2.8L USM\",\"LensSerialNumber\":\"0000000000\",\"ThumbnailOffset\":\"1026\",\"ThumbnailLength\":\"2485\",\"XMPToolkit\":\"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27\",\"CreatorTool\":\"Adobe Photoshop CC 2017 (Macintosh)\",\"MetadataDate\":\"2020:07:21 09:09:49+02:00\",\"Lens\":\"Canon EF 24-70mm f/2.8L USM\",\"FlashCompensation\":\"0\",\"Firmware\":\"Firmware Version 1.3.5\",\"ApproximateFocusDistance\":\"0\",\"DateCreated\":\"2020:06:29 16:23:35.006\",\"LegacyIPTCDigest\":\"D40FE785184DBB6FB5BF7A7ECD8E78A8\",\"ColorMode\":\"RGB\",\"ICCProfileName\":\"sRGB IEC61966-2.1\",\"History\":\"2020-07-01T11:58:39+07:00\\tFile 202B0021T301CE947_SLr_UC269212.jpg opened\\n2020-07-01T12:02:15+07:00\\tFile 202B0021T301CE947_SLr_UC269212.tif saved\\n2020-07-01T14:03:11+07:00\\tFile 202B0021T301CE947_SLr_UC269212.tif saved\",\"DocumentID\":\"adobe:docid:photoshop:8e9a7a9c-e21f-ac4a-a50e-8b1d866d3a91\",\"InstanceID\":\"xmp.iid:F6A7E22021CBEA11B638B4A2589ABD39\",\"OriginalDocumentID\":\"86A51DEDCD26006221E7A13DA8F0EE2B\",\"Format\":\"image/jpeg\",\"HistoryAction\":\"saved, converted, derived, saved, saved, converted, derived, saved\",\"HistoryInstanceID\":\"xmp.iid:93FFFFF42B2068118083C9347BD6D104, xmp.iid:94FFFFF42B2068118083C9347BD6D104, xmp.iid:F5A7E22021CBEA11B638B4A2589ABD39, xmp.iid:F6A7E22021CBEA11B638B4A2589ABD39\",\"HistoryWhen\":\"2020:07:01 12:02:15+07:00, 2020:07:01 12:02:15+07:00, 2020:07:21 09:09:49+02:00, 2020:07:21 09:09:49+02:00\",\"HistorySoftwareAgent\":\"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)\",\"HistoryChanged\":\"/, /, /, /\",\"HistoryParameters\":\"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg\",\"DerivedFromInstanceID\":\"xmp.iid:F5A7E22021CBEA11B638B4A2589ABD39\",\"DerivedFromDocumentID\":\"adobe:docid:photoshop:8e9a7a9c-e21f-ac4a-a50e-8b1d866d3a91\",\"DerivedFromOriginalDocumentID\":\"86A51DEDCD26006221E7A13DA8F0EE2B\",\"IPTCDigest\":\"c70df291a3b4f547ccc4ae94877fb195\",\"DisplayedUnitsX\":\"inches\",\"DisplayedUnitsY\":\"inches\",\"PrintStyle\":\"Centered\",\"PrintPosition\":\"0 0\",\"PrintScale\":\"1\",\"GlobalAngle\":\"30\",\"GlobalAltitude\":\"30\",\"URL_List\":\"\",\"SlicesGroupName\":\"ps14876_8D7BCDB\",\"NumSlices\":\"1\",\"PixelAspectRatio\":\"1\",\"HasRealMergedData\":\"Yes\",\"WriterName\":\"Adobe Photoshop\",\"ReaderName\":\"Adobe Photoshop CS6\",\"PhotoshopQuality\":\"11\",\"PhotoshopFormat\":\"Standard\",\"ProgressiveScans\":\"3 Scans\",\"ProfileDescription\":\"sRGB IEC61966-2.1\",\"Colorspace\":\"RGB\",\"DPI\":\"72\"},\"colors\":[[\"#D2C6B4\",87.3],[\"#D3D3CD\",9.3]],\"predominant\":{\"google\":[[\"gray\",87.3],[\"white\",9.3]],\"cloudinary\":[[\"white\",96.6]]},\"phash\":\"264fd8cc89cd9627\",\"coordinates\":{\"faces\":[]},\"illustration_score\":0.0,\"semi_transparent\":false,\"grayscale\":false,\"quality_analysis\":{\"focus\":1.0},\"original_filename\":\"72baa2e7-2dd7-42b6-9ae0-dabd63ae3126\"}"

    Please try it with that and let me know how you get on.

    Please let me know if you have any other questions or queries.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas, the triple quotes i think that was created by my IDE.

    So for this account the validation is working for the following request:

    private val demoBody =
    "{\"notification_type\":\"upload\",\"timestamp\":\"2022-06-21T12:21:37+00:00\",\"request_id\":\"b7047810c03830f4b6da7b6a1b8bb293\",\"asset_id\":\"92c14d2fd9dd55c415534280d7b8dac2\",\"public_id\":\"test/digitalassets/original/dd357e7a-9375-4e90-bd09-d8a9f9f1dd2f\",\"version\":1655814095,\"version_id\":\"10d567813810491a46df434bbb547527\",\"width\":1045,\"height\":1600,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2022-06-21T12:21:35Z\",\"tags\":[],\"bytes\":129435,\"type\":\"upload\",\"etag\":\"d8a0462b16a515a276a157294e48458f\",\"placeholder\":false,\"url\":\"http://res.cloudinary.com/test-seecommerce/image/upload/v1655814095/test/digitalassets/original/dd357e7a-9375-4e90-bd09-d8a9f9f1dd2f.jpg\",\"secure_url\":\"https://res.cloudinary.com/test-seecommerce/image/upload/v1655814095/test/digitalassets/original/dd357e7a-9375-4e90-bd09-d8a9f9f1dd2f.jpg\",\"folder\":\"test/digitalassets/original\",\"access_mode\":\"public\",\"original_filename\":\"d1368628-2603-4d99-b785-957945d1e560\"}"
    private val demoTimestamp = "1655814099"
    private val demoSignature = "0b23323227ecd4f1f5f22400c75bf825f2a639e7"

    for my customer we're trying to validate with the following data and the Cloudinary SDK is returning false.

     

    private val customerBody =
    "{\"notification_type\":\"upload\",\"timestamp\":\"2022-09-14T08:19:31+00:00\",\"request_id\":\"b46c8e28e3f65de16ab5f57faf2c6c5c\",\"asset_id\":\"e5142c67f45870d977780747d249b53c\",\"public_id\":\"dev/seecommerce/original/202B0021T301-CE947-F\",\"version\":1663143564,\"version_id\":\"9646467baa0de08604a3512f47616dd5\",\"width\":1571,\"height\":2000,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2022-09-14T08:19:24Z\",\"tags\":[],\"bytes\":1224089,\"type\":\"upload\",\"etag\":\"38d351d7871ab92ef9f7a36006a9f8ee\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"folder\":\"dev/seecommerce/original\",\"access_mode\":\"public\",\"image_metadata\":{\"CodedCharacterSet\":\"UTF8\",\"ApplicationRecordVersion\":\"4\",\"TimeCreated\":\"16:22:25+00:00\",\"DigitalCreationDate\":\"2020:06:29\",\"ImageWidth\":\"1571\",\"ImageHeight\":\"2000\",\"BitsPerSample\":\"8 8 8\",\"Compression\":\"LZW\",\"PhotometricInterpretation\":\"RGB\",\"Make\":\"Canon\",\"Model\":\"Canon EOS 5D Mark III\",\"Orientation\":\"Horizontal (normal)\",\"SamplesPerPixel\":\"3\",\"XResolution\":\"72\",\"YResolution\":\"72\",\"PlanarConfiguration\":\"Chunky\",\"ResolutionUnit\":\"inches\",\"Software\":\"Adobe Photoshop CS6 (Windows)\",\"ModifyDate\":\"2020:07:21 09:09:39\",\"ExposureTime\":\"1/125\",\"FNumber\":\"16.0\",\"ExposureProgram\":\"Manual\",\"ISO\":\"100\",\"SensitivityType\":\"Recommended Exposure Index\",\"RecommendedExposureIndex\":\"100\",\"ExifVersion\":\"0230\",\"DateTimeOriginal\":\"2020:06:29 16:22:25\",\"CreateDate\":\"2020:06:29 16:22:25\",\"ShutterSpeedValue\":\"1/125\",\"ApertureValue\":\"16.0\",\"ExposureCompensation\":\"0\",\"SubjectDistance\":\"0 m\",\"MeteringMode\":\"Multi-segment\",\"Flash\":\"Off, Did not fire\",\"FocalLength\":\"70.0 mm\",\"SubSecTimeOriginal\":\"59\",\"SubSecTimeDigitized\":\"59\",\"ColorSpace\":\"sRGB\",\"ExifImageWidth\":\"1571\",\"ExifImageHeight\":\"2000\",\"FocalPlaneXResolution\":\"3942.505127\",\"FocalPlaneYResolution\":\"3950.617188\",\"FocalPlaneResolutionUnit\":\"inches\",\"FileSource\":\"Digital Camera\",\"SceneType\":\"Directly photographed\",\"CustomRendered\":\"Normal\",\"ExposureMode\":\"Manual\",\"WhiteBalance\":\"Manual\",\"SceneCaptureType\":\"Standard\",\"SerialNumber\":\"083024003753\",\"LensInfo\":\"24-70mm f/?\",\"LensModel\":\"Canon EF 24-70mm f/2.8L USM\",\"LensSerialNumber\":\"0000000000\",\"ThumbnailOffset\":\"1026\",\"ThumbnailLength\":\"2712\",\"XMPToolkit\":\"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27\",\"CreatorTool\":\"Adobe Photoshop CC 2017 (Macintosh)\",\"MetadataDate\":\"2020:07:21 09:09:39+02:00\",\"Lens\":\"Canon EF 24-70mm f/2.8L USM\",\"FlashCompensation\":\"0\",\"Firmware\":\"Firmware Version 1.3.5\",\"ApproximateFocusDistance\":\"0\",\"DateCreated\":\"2020:06:29 16:22:25.059\",\"LegacyIPTCDigest\":\"FC9B262B022BCA19D69E340FFE0203A7\",\"ColorMode\":\"RGB\",\"ICCProfileName\":\"sRGB IEC61966-2.1\",\"History\":\"2020-07-01T10:45:55+07:00\\tFile 202B0021T301CE947_SLf_UC269198.jpg opened\\n2020-07-01T10:55:56+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:25:59+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:54:56+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\\n2020-07-01T14:03:27+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif opened\\n2020-07-01T14:06:11+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\",\"DocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"InstanceID\":\"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"OriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"Format\":\"image/jpeg\",\"HistoryAction\":\"saved, converted, derived, saved, saved, converted, derived, saved\",\"HistoryInstanceID\":\"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"HistoryWhen\":\"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00\",\"HistorySoftwareAgent\":\"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)\",\"HistoryChanged\":\"/, /, /, /\",\"HistoryParameters\":\"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg\",\"DerivedFromInstanceID\":\"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40\",\"DerivedFromDocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"DerivedFromOriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"IPTCDigest\":\"757b10760355343c6c2ecf8f7d6e49b2\",\"DisplayedUnitsX\":\"inches\",\"DisplayedUnitsY\":\"inches\",\"PrintStyle\":\"Centered\",\"PrintPosition\":\"0 0\",\"PrintScale\":\"1\",\"GlobalAngle\":\"30\",\"GlobalAltitude\":\"30\",\"URL_List\":\"\",\"SlicesGroupName\":\"ps14883_14221AE9\",\"NumSlices\":\"1\",\"PixelAspectRatio\":\"1\",\"HasRealMergedData\":\"Yes\",\"WriterName\":\"Adobe Photoshop\",\"ReaderName\":\"Adobe Photoshop CS6\",\"PhotoshopQuality\":\"11\",\"PhotoshopFormat\":\"Standard\",\"ProgressiveScans\":\"3 Scans\",\"original_filename\":\"9ef2320e-b0c5-4847-8f1f-2cd8181fee15\"}"
    private val customerTimestamp = "1663143800"
    private val customerSignature = "87d668c49f154bb80934184de29e342f8196652f"



    So I get two questions:

    • Why here the validation is not working?
    • Why there are so many extra fields in my customer JSON?

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back.

    I'm seeing a lot of 500 response from your webhook notification for that customer, this may not be the reason for the error but could you check if your endpoint is having any issues?

    Also, the reason why they have so many fields in the response is that they are using a default upload preset which has image_metadata enabled so extra data is included in the response. 

    I just did a test upload to that account and verification was true with the following data:

    body = "{\"notification_type\":\"upload\",\"timestamp\":\"2022-09-14T12:06:15+00:00\",\"request_id\":\"380165e89cc02c33cae9f244dbd3a201\",\"asset_id\":\"2ebedd507f9df6f30b124281881d7bbd\",\"public_id\":\"sample\",\"version\":1656655605,\"version_id\":\"4932ed07df1512a66ea88f510c5543dc\",\"width\":864,\"height\":576,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2020-09-16T13:37:50Z\",\"tags\":[],\"pages\":1,\"bytes\":120253,\"type\":\"upload\",\"etag\":\"83340520d28b704ca4f4b019effb33dc\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1656655605/sample.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1656655605/sample.jpg\",\"folder\":\"\",\"access_mode\":\"public\",\"overwritten\":true,\"faces\":[],\"image_metadata\":{\"JFIFVersion\":\"1.01\",\"ResolutionUnit\":\"inches\",\"XResolution\":\"100\",\"YResolution\":\"100\",\"Colorspace\":\"RGB\",\"DPI\":\"100\"},\"colors\":[[\"#56750E\",15.6],[\"#ABC564\",13.8],[\"#2A4004\",12.4],[\"#E51C42\",10.7],[\"#748F34\",10.3],[\"#122A02\",6.7],[\"#F26492\",3.8],[\"#FB86CD\",3.7],[\"#86050C\",3.7],[\"#C3CF6A\",3.6],[\"#838D36\",1.8],[\"#6F7A10\",1.6],[\"#F5AB0E\",1.3],[\"#FCCCEB\",1.0],[\"#372E05\",1.0],[\"#E3BF72\",0.9],[\"#D35614\",0.6],[\"#7A5810\",0.6],[\"#D4CD68\",0.5],[\"#85330C\",0.5],[\"#E29068\",0.5]],\"predominant\":{\"google\":[[\"green\",48.1],[\"brown\",16.0],[\"red\",15.0],[\"pink\",8.5],[\"yellow\",4.1],[\"orange\",2.7]],\"cloudinary\":[[\"olive\",43.1],[\"green\",19.1],[\"red\",15.0],[\"pink\",8.5],[\"yellow\",4.1],[\"orange\",2.7],[\"brown\",2.0]]},\"phash\":\"c9635a63eacf11c1\",\"coordinates\":{\"faces\":[]},\"illustration_score\":0.0,\"semi_transparent\":false,\"grayscale\":false,\"quality_analysis\":{\"focus\":0.5301076173782349},\"original_filename\":\"sample\"}"
    timestamp = 1663157188
    signature = 94e519fb02f2a3bdd8cb8d7acd5885458cf2dbd5

    Can you send me the full response headers and json body of the test you are doing before parsing the data?

    Thanks,

    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    I tried with your same body, timesmap and signature but the SDK is returning to me false.

     

    I share some of our codes with the hopes that it can helps.


    This is our verifySignature method:

    override def verifySignature(body: String, timestamp: String, signature: String): ZIO[Any, Throwable, Boolean] = {
    for {
    _ <- ZIO.effect(
    logger.debug(
    s"CloudinaryClient.verifySignature with body: $body, timestamp $timestamp and signature $signature with apiSecret ${cloudinaryAccount.apiSecret.value}"
    )
    )
    signatureVerifier <- ZIO.effect(new NotificationRequestSignatureVerifier(cloudinaryAccount.apiSecret.value))
    result <- ZIO.effect(signatureVerifier.verifySignature(body, timestamp, signature))
    _ <- ZIO.effect(logger.debug(s"CloudinaryClient.verifySignature result $result"))
    } yield result
    }

     

    In the project we're using the Java SDK, with JDK 11 used by a Scala 2.12.15 project. These are the two dependencies that we're introducing inside:

    "com.cloudinary" % "cloudinary-core" % "1.32.2",
    "com.cloudinary" % "cloudinary-http44" % "1.32.2",

     

    This is the spec part that I written to test:

    "return true if the body is valid for the signature for customer Client" in {
    Runtime.default
    .unsafeRunToFuture(client.verifySignature(body, timestamp, signature))
    .future
    .futureValue shouldBe true
    }

    We created this wrapper here with this config to use for the verify and upload operations:

    final case class CloudinaryClient(tenant: TenantId, cloudinaryAccount: CloudinaryAccount)
    extends CDNClient
    with LazyLogging {

    private val client: Cloudinary = new Cloudinary(
    ObjectUtils.asMap(CloudName,
    cloudinaryAccount.cloudName.value,
    ApiKey,
    cloudinaryAccount.apiKey.value,
    ApiSecret,
    cloudinaryAccount.apiSecret.value,
    Secure,
    Boolean.box(true)
    )
    )


    Let me know if you needs some extra informations.

     

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back.

    It's probably failing for you now because the valid_for time has elapsed, if you set it to `valid_for=86400` (24 hours) does it work?

    The code looks ok, it looks like you get the customers' API secret before validating so the issue most probably lies in the body you are sending, if it's not exactly the same as what we sent then validation will fail. 

    Can you confirm if body is being parsed through some middleware? For example, we've had cases where we send duration: 30.0 but on client side, the json parsing middleware being used was returning it as duration: 30.

    Could you also send us the full webhook notification and response headers before your app processes it? If it's valid this way then we know something in your app is causing the failure. 

    Kind Regards,
    Thomas 

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    I can confirm that we're using https://github.com/circe/circe for deserialize the entity.

    I'm going to provide the body I'm receiving from your system with all the details.

     

     

    Best regards

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back.

    I'm looking forward to your response.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    here some logs extracts from the api-gateway service that we're using. So before the request is coming into our system.

    This is the validation that's working:

    endpoint: aws_url:30021/cloudinaryNotification/DEMO/seecommerce/f24efe1f-0b36-4248-b4d4-991b46efe0b1?targetKey=dev/seecommerce/original/6RjdSIa7Bi8IN7Dj-111-B&userId=auth0%7C5dd40503f51b5c0f39c4c928

    json:

    {
        "notification_type": "upload",
        "timestamp": "2022-08-22T08:02:07+00:00",
        "request_id": "0a77d3d9b95a1e06bb959f47df2da6c4",
        "asset_id": "d57b356076a969d9689441361b09d799",
        "public_id": "dev/seecommerce/original/03wQdhpgGekH9OtW-111-F",
        "version": 1661155324,
        "version_id": "d689afa371f4a5d60d8834e8ccc2ff42",
        "width": 4000,
        "height": 5000,
        "format": "jpg",
        "resource_type": "image",
        "created_at": "2022-07-28T13:43:56Z",
        "tags": [],
        "bytes": 2349065,
        "type": "upload",
        "etag": "41b8bd035102d19881b607a9bf1e9f07",
        "placeholder": false,
        "url": "http://res.cloudinary.com/test-seecommerce/image/upload/v1661155324/dev/seecommerce/original/03wQdhpgGekH9OtW-111-F.jpg",
        "secure_url": "https://res.cloudinary.com/test-seecommerce/image/upload/v1661155324/dev/seecommerce/original/03wQdhpgGekH9OtW-111-F.jpg",
        "folder": "dev/seecommerce/original",
        "access_mode": "public",
        "overwritten": true,
        "original_filename": "7ccfcb82-fdb0-4195-9fbc-1bf6741869e9",
        "original_extension": "jpeg"
    }

     

    This instead is the details for the Json that we're not able to validate:

    endpoint: aws_url:30021/cloudinaryNotification/CUCINELLI/seecommerce/9ef2320e-b0c5-4847-8f1f-2cd8181fee15?targetKey=dev/seecommerce/original/202B0021T301-CE947-F&userId=9ee83a99-53e8-42f3-bf8b-ffcb13747d5a

     

    json:


    {
       "notification_type":"upload",
       "timestamp":"2022-09-16T08:20:10+00:00",
       "request_id":"be3922a9556873cc7a4d3758075aba73",
       "asset_id":"32f9fdf4cefbd33fc194e2e41ec8a972",
       "public_id":"dev/seecommerce/original/202B289LP106-C2005-F",
       "version":1663316402,
       "version_id":"b2e91ce9996e05a9b858fb6007e34b5b",
       "width":1571,
       "height":2000,
       "format":"jpg",
       "resource_type":"image",
       "created_at":"2022-09-16T08:20:02Z",
       "tags":[
          
       ],
       "pages":1,
       "bytes":1196296,
       "type":"upload",
       "etag":"a061988ab245a36dcbdfddf677609b82",
       "placeholder":false,
       "url":"http://media.brunellocucinelli.com/image/upload/v1663316402/dev/seecommerce/original/202B289LP106-C2005-F.jpg",
       "secure_url":"https://media.brunellocucinelli.com/image/upload/v1663316402/dev/seecommerce/original/202B289LP106-C2005-F.jpg",
       "folder":"dev/seecommerce/original",
       "access_mode":"public",
       "faces":[
          
       ],
       "image_metadata":{
          "CodedCharacterSet":"UTF8",
          "ApplicationRecordVersion":"4",
          "TimeCreated":"10:27:27+00:00",
          "DigitalCreationDate":"2020:10:02",
          "ImageWidth":"1571",
          "ImageHeight":"2000",
          "BitsPerSample":"8 8 8",
          "Compression":"LZW",
          "PhotometricInterpretation":"RGB",
          "Make":"Canon",
          "Model":"Canon EOS 5D Mark II",
          "Orientation":"Horizontal (normal)",
          "SamplesPerPixel":"3",
          "XResolution":"72",
          "YResolution":"72",
          "PlanarConfiguration":"Chunky",
          "ResolutionUnit":"inches",
          "Software":"Adobe Photoshop CS6 (Windows)",
          "ModifyDate":"2020:10:08 09:53:32",
          "ExposureTime":"1/125",
          "FNumber":"14.0",
          "ExposureProgram":"Manual",
          "ISO":"200",
          "ExifVersion":"0230",
          "DateTimeOriginal":"2020:10:02 10:27:27",
          "CreateDate":"2020:10:02 10:27:27",
          "ShutterSpeedValue":"1/125",
          "ApertureValue":"14.0",
          "ExposureCompensation":"0",
          "SubjectDistance":"0 m",
          "MeteringMode":"Multi-segment",
          "Flash":"Off, Did not fire",
          "FocalLength":"40.0 mm",
          "SubSecTimeOriginal":"97",
          "SubSecTimeDigitized":"97",
          "ColorSpace":"sRGB",
          "ExifImageWidth":"1571",
          "ExifImageHeight":"2000",
          "FocalPlaneXResolution":"3849.21167",
          "FocalPlaneYResolution":"3908.141846",
          "FocalPlaneResolutionUnit":"inches",
          "FileSource":"Digital Camera",
          "SceneType":"Directly photographed",
          "CustomRendered":"Normal",
          "ExposureMode":"Manual",
          "WhiteBalance":"Auto",
          "SceneCaptureType":"Standard",
          "SerialNumber":"320212795",
          "LensModel":"Canon EF 24-105mm f/4L IS USM",
          "ThumbnailOffset":"934",
          "ThumbnailLength":"2693",
          "XMPToolkit":"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27",
          "Lens":"Canon EF 24-105mm f/4L IS USM",
          "FlashCompensation":"0",
          "Firmware":"Firmware Version 1.0.6",
          "ApproximateFocusDistance":"0",
          "DateCreated":"2020:10:02 10:27:27.097",
          "LegacyIPTCDigest":"C9DE62709307DC061208249FB8A16CF7",
          "ColorMode":"RGB",
          "ICCProfileName":"sRGB IEC61966-2.1",
          "CreatorTool":"Adobe Photoshop CC 2018 (Macintosh)",
          "MetadataDate":"2020:10:08 09:53:32+02:00",
          "DocumentID":"adobe:docid:photoshop:25855a77-ae53-f94c-b951-50819e7c0e90",
          "InstanceID":"xmp.iid:81C773523B09EB11B5D8E6C7487C7473",
          "OriginalDocumentID":"498322A09D3C2AF47455C790AD2BBEBF",
          "Format":"image/jpeg",
          "HistoryAction":"saved, converted, derived, saved, saved, converted, derived, saved",
          "HistoryInstanceID":"xmp.iid:EC5331C31D2068118083DD1CC5D40B4E, xmp.iid:ED5331C31D2068118083DD1CC5D40B4E, xmp.iid:80C773523B09EB11B5D8E6C7487C7473, xmp.iid:81C773523B09EB11B5D8E6C7487C7473",
          "HistoryWhen":"2020:10:03 06:00:59-07:00, 2020:10:03 06:00:59-07:00, 2020:10:08 09:53:32+02:00, 2020:10:08 09:53:32+02:00",
          "HistorySoftwareAgent":"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)",
          "HistoryChanged":"/, /, /, /",
          "HistoryParameters":"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg",
          "DerivedFromInstanceID":"xmp.iid:80C773523B09EB11B5D8E6C7487C7473",
          "DerivedFromDocumentID":"adobe:docid:photoshop:25855a77-ae53-f94c-b951-50819e7c0e90",
          "DerivedFromOriginalDocumentID":"498322A09D3C2AF47455C790AD2BBEBF",
          "IPTCDigest":"d8e8e6809bddc3a67516b113ce2f1fab",
          "DisplayedUnitsX":"inches",
          "DisplayedUnitsY":"inches",
          "PrintStyle":"Centered",
          "PrintPosition":"0 0",
          "PrintScale":"1",
          "GlobalAngle":"30",
          "GlobalAltitude":"30",
          "URL_List":"",
          "SlicesGroupName":"ps14883_7B692607",
          "NumSlices":"1",
          "PixelAspectRatio":"1",
          "HasRealMergedData":"Yes",
          "WriterName":"Adobe Photoshop",
          "ReaderName":"Adobe Photoshop CS6",
          "PhotoshopQuality":"11",
          "PhotoshopFormat":"Standard",
          "ProgressiveScans":"3 Scans",
          "ProfileDescription":"sRGB IEC61966-2.1",
          "Colorspace":"RGB",
          "DPI":"72"
       },
       "colors":[
          [
             "#CEC2B1",
             73.7
          ],
          [
             "#B88254",
             19.9
          ],
          [
             "#9E683F",
             5.6
          ]
       ],
       "predominant":{
          "google":[
             [
                "gray",
                73.7
             ],
             [
                "orange",
                19.9
             ],
             [
                "brown",
                5.6
             ]
          ],
          "cloudinary":[
             [
                "gray",
                73.7
             ],
             [
                "brown",
                25.5
             ]
          ]
       },
       "phash":"d3c3f14e34cc3c32",
       "coordinates":{
          "faces":[
             
          ]
       },
       "illustration_score":0.0,
       "semi_transparent":false,
       "grayscale":false,
       "quality_analysis":{
          "focus":0.8767565488815308
       },
       "original_filename":"642a50c8-963a-43ad-8c30-ca8d4e734016"
    }

     

    Is it not possible to be called with already the json in one line? We're doing some transformation just to remove all the spaces using: 

    notification.noSpaces

    that's generating a String from our Json object.

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back and apologies in the delay, for some reason I did not get alerted on your update. 

    I'm looking into it now so will get back to you asap.

    Thanks,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for waiting. 

    So the json data we sent looks fine, could you send me the timestamp and signature from the response headers as well for that? 

    You mentioned you removed spaces before converting to a string and this is probably what's causing the mismatch. 

    I would recommend just storing the raw json data from the response -> escape the double quotes -> then convert to string without performing any other parsing.

    I'm looking forward to your response.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    sorry but If I'm not removing the spaces the verify is not working also for the original json that's working.

     

    Is it not possibile to receive the json already without spaces in the request? It's this the reason why we'are doing that.

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back. 

    So the raw content of the JSON will not have any spaces in it, when you receive the JSON payload, do you apply any indentation to it? If so, that may be causing the verification to fail. 

    e.g. here is a test I did and this is the payload I received

    {"notification_type":"upload","timestamp":"2022-09-28T08:57:37+00:00","request_id":"feb50ed4de2478d329a0620342b75b96","asset_id":"2ebedd507f9df6f30b124281881d7bbd","public_id":"sample","version":1664355440,"version_id":"e5d23b9d9e2686fc9a72d527f5c67073","width":3508,"height":2339,"format":"jpg","resource_type":"image","created_at":"2020-09-16T13:37:50Z","tags":[],"pages":1,"bytes":654643,"type":"upload","etag":"2ddbb15c5a292f6e037b19a9ac5f614c","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg","folder":"","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"JFIFVersion":"1.01","ResolutionUnit":"None","XResolution":"1","YResolution":"1","Colorspace":"RGB","DPI":"0"},"colors":[["#56750E",15.4],["#ABC464",13.5],["#2A4004",12.5],["#E51D42",10.7],["#748F34",10.3],["#122A02",6.5],["#C2CF6A",3.8],["#F26492",3.8],["#86050C",3.7],["#FB85CD",3.6],["#838D35",2.0],["#6E7B10",1.7],["#F4AB0E",1.3],["#FCCCEA",1.0],["#382E05",1.0],["#E2BF72",0.9],["#D35614",0.7],["#795811",0.6],["#E08F67",0.5],["#D3CC68",0.5],["#84320D",0.5]],"predominant":{"google":[["green",47.7],["brown",16.2],["red",15.0],["pink",8.5],["yellow",4.3],["orange",2.8]],"cloudinary":[["olive",42.8],["green",19.0],["red",15.0],["pink",8.5],["yellow",4.3],["orange",2.8],["brown",2.0]]},"phash":"cd615a63eacf11c1","coordinates":{"faces":[]},"illustration_score":0.19252464175224304,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":0.1011592224240303},"original_filename":"sample"}

    The signature is `c0129009b1d5cf712d0a4554c9761ac9a26f08fa` and timestamp `1664355485`. 

    Using the verify method from Python SDK with the above data I get a valid signature response. 

    From your most recent example as well, I see extra line breaks here:

    "tags":[
          
     ],
    "faces":[
          
       ],

    And they should not be there, it should be similar to your working example e.g. 

    "tags": [],

    So its possible your space removal step is not taking the line breaks into account, can you remove the line breaks as well and see if it works? 

    The best option would of course be just to receive the JSON payload in raw format and just escape the double quotes.

    I'm looking forward to your response.

    Kind Regards,
    Thomas
     

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    I tried with your data but the validation is returning false, here the snipped I created to test it:

    private val supportDemoBody =
    "{\"notification_type\":\"upload\",\"timestamp\":\"2022-09-28T08:57:37+00:00\",\"request_id\":\"feb50ed4de2478d329a0620342b75b96\",\"asset_id\":\"2ebedd507f9df6f30b124281881d7bbd\",\"public_id\":\"sample\",\"version\":1664355440,\"version_id\":\"e5d23b9d9e2686fc9a72d527f5c67073\",\"width\":3508,\"height\":2339,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2020-09-16T13:37:50Z\",\"tags\":[],\"pages\":1,\"bytes\":654643,\"type\":\"upload\",\"etag\":\"2ddbb15c5a292f6e037b19a9ac5f614c\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg\",\"folder\":\"\",\"access_mode\":\"public\",\"overwritten\":true,\"faces\":[],\"image_metadata\":{\"JFIFVersion\":\"1.01\",\"ResolutionUnit\":\"None\",\"XResolution\":\"1\",\"YResolution\":\"1\",\"Colorspace\":\"RGB\",\"DPI\":\"0\"},\"colors\":[[\"#56750E\",15.4],[\"#ABC464\",13.5],[\"#2A4004\",12.5],[\"#E51D42\",10.7],[\"#748F34\",10.3],[\"#122A02\",6.5],[\"#C2CF6A\",3.8],[\"#F26492\",3.8],[\"#86050C\",3.7],[\"#FB85CD\",3.6],[\"#838D35\",2.0],[\"#6E7B10\",1.7],[\"#F4AB0E\",1.3],[\"#FCCCEA\",1.0],[\"#382E05\",1.0],[\"#E2BF72\",0.9],[\"#D35614\",0.7],[\"#795811\",0.6],[\"#E08F67\",0.5],[\"#D3CC68\",0.5],[\"#84320D\",0.5]],\"predominant\":{\"google\":[[\"green\",47.7],[\"brown\",16.2],[\"red\",15.0],[\"pink\",8.5],[\"yellow\",4.3],[\"orange\",2.8]],\"cloudinary\":[[\"olive\",42.8],[\"green\",19.0],[\"red\",15.0],[\"pink\",8.5],[\"yellow\",4.3],[\"orange\",2.8],[\"brown\",2.0]]},\"phash\":\"cd615a63eacf11c1\",\"coordinates\":{\"faces\":[]},\"illustration_score\":0.19252464175224304,\"semi_transparent\":false,\"grayscale\":false,\"quality_analysis\":{\"focus\":0.1011592224240303},\"original_filename\":\"sample\"}"
    private val supportSignature = "c0129009b1d5cf712d0a4554c9761ac9a26f08fa"
    private val supportTimestamp = "1664355485"

    "return true if the body is valid for the support body" in {
    println(s"here the string with escape characters: $supportDemoBody")
    Runtime.default
    .unsafeRunToFuture(cloudinaryClient.verifySignature(supportDemoBody, supportTimestamp, supportSignature))
    .future
    .futureValue shouldBe true
    }


    Here instead the logging about the json before validate, with the logger:

    {"notification_type":"upload","timestamp":"2022-09-28T08:57:37+00:00","request_id":"feb50ed4de2478d329a0620342b75b96","asset_id":"2ebedd507f9df6f30b124281881d7bbd","public_id":"sample","version":1664355440,"version_id":"e5d23b9d9e2686fc9a72d527f5c67073","width":3508,"height":2339,"format":"jpg","resource_type":"image","created_at":"2020-09-16T13:37:50Z","tags":[],"pages":1,"bytes":654643,"type":"upload","etag":"2ddbb15c5a292f6e037b19a9ac5f614c","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1664355440/sample.jpg","folder":"","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"JFIFVersion":"1.01","ResolutionUnit":"None","XResolution":"1","YResolution":"1","Colorspace":"RGB","DPI":"0"},"colors":[["#56750E",15.4],["#ABC464",13.5],["#2A4004",12.5],["#E51D42",10.7],["#748F34",10.3],["#122A02",6.5],["#C2CF6A",3.8],["#F26492",3.8],["#86050C",3.7],["#FB85CD",3.6],["#838D35",2.0],["#6E7B10",1.7],["#F4AB0E",1.3],["#FCCCEA",1.0],["#382E05",1.0],["#E2BF72",0.9],["#D35614",0.7],["#795811",0.6],["#E08F67",0.5],["#D3CC68",0.5],["#84320D",0.5]],"predominant":{"google":[["green",47.7],["brown",16.2],["red",15.0],["pink",8.5],["yellow",4.3],["orange",2.8]],"cloudinary":[["olive",42.8],["green",19.0],["red",15.0],["pink",8.5],["yellow",4.3],["orange",2.8],["brown",2.0]]},"phash":"cd615a63eacf11c1","coordinates":{"faces":[]},"illustration_score":0.19252464175224304,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":0.1011592224240303},"original_filename":"sample"}


    Here I'm using the Java SDK and my current Cloudinary Account, can be this the kind of error?

    Furthermore the escape character are automatically added from our Json lib (https://github.com/circe/circe)
    when the endpoint is decoding the Json body.

    When I'm looking into the body that we're receiving from the endpoint callback I can see that we've already Json in multi line alignment, this is why we're doing a .noSpaces call.

     

    Waiting for the response,

     

    Best regards,

    Alberto

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    here my service callback debug information that is not working the verify (for the same customer).

    body: {"notification_type":"upload","timestamp":"2022-09-28T13:14:57+00:00","request_id":"4054dfffb87256c4348435563f662a26","asset_id":"e5142c67f45870d977780747d249b53c","public_id":"dev/seecommerce/original/202B0021T301-CE947-F","version":1663143564,"version_id":"9646467baa0de08604a3512f47616dd5","width":1571,"height":2000,"format":"jpg","resource_type":"image","created_at":"2022-09-14T08:19:24Z","tags":[],"pages":1,"bytes":1224089,"type":"upload","etag":"38d351d7871ab92ef9f7a36006a9f8ee","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","folder":"dev/seecommerce/original","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"CodedCharacterSet":"UTF8","ApplicationRecordVersion":"4","TimeCreated":"16:22:25+00:00","DigitalCreationDate":"2020:06:29","ImageWidth":"1571","ImageHeight":"2000","BitsPerSample":"8 8 8","Compression":"LZW","PhotometricInterpretation":"RGB","Make":"Canon","Model":"Canon EOS 5D Mark III","Orientation":"Horizontal (normal)","SamplesPerPixel":"3","XResolution":"72","YResolution":"72","PlanarConfiguration":"Chunky","ResolutionUnit":"inches","Software":"Adobe Photoshop CS6 (Windows)","ModifyDate":"2020:07:21 09:09:39","ExposureTime":"1/125","FNumber":"16.0","ExposureProgram":"Manual","ISO":"100","SensitivityType":"Recommended Exposure Index","RecommendedExposureIndex":"100","ExifVersion":"0230","DateTimeOriginal":"2020:06:29 16:22:25","CreateDate":"2020:06:29 16:22:25","ShutterSpeedValue":"1/125","ApertureValue":"16.0","ExposureCompensation":"0","SubjectDistance":"0 m","MeteringMode":"Multi-segment","Flash":"Off, Did not fire","FocalLength":"70.0 mm","SubSecTimeOriginal":"59","SubSecTimeDigitized":"59","ColorSpace":"sRGB","ExifImageWidth":"1571","ExifImageHeight":"2000","FocalPlaneXResolution":"3942.505127","FocalPlaneYResolution":"3950.617188","FocalPlaneResolutionUnit":"inches","FileSource":"Digital Camera","SceneType":"Directly photographed","CustomRendered":"Normal","ExposureMode":"Manual","WhiteBalance":"Manual","SceneCaptureType":"Standard","SerialNumber":"083024003753","LensInfo":"24-70mm f/?","LensModel":"Canon EF 24-70mm f/2.8L USM","LensSerialNumber":"0000000000","ThumbnailOffset":"1026","ThumbnailLength":"2712","XMPToolkit":"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27","CreatorTool":"Adobe Photoshop CC 2017 (Macintosh)","MetadataDate":"2020:07:21 09:09:39+02:00","Lens":"Canon EF 24-70mm f/2.8L USM","FlashCompensation":"0","Firmware":"Firmware Version 1.3.5","ApproximateFocusDistance":"0","DateCreated":"2020:06:29 16:22:25.059","LegacyIPTCDigest":"FC9B262B022BCA19D69E340FFE0203A7","ColorMode":"RGB","ICCProfileName":"sRGB IEC61966-2.1","History":"2020-07-01T10:45:55+07:00\tFile 202B0021T301CE947_SLf_UC269198.jpg opened\n2020-07-01T10:55:56+07:00\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\n2020-07-01T11:25:59+07:00\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\n2020-07-01T11:54:56+07:00\tFile 202B0021T301CE947_SLf_UC269198.tif saved\n2020-07-01T14:03:27+07:00\tFile 202B0021T301CE947_SLf_UC269198.tif opened\n2020-07-01T14:06:11+07:00\tFile 202B0021T301CE947_SLf_UC269198.tif saved","DocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","InstanceID":"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","OriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","Format":"image/jpeg","HistoryAction":"saved, converted, derived, saved, saved, converted, derived, saved","HistoryInstanceID":"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","HistoryWhen":"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00","HistorySoftwareAgent":"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)","HistoryChanged":"/, /, /, /","HistoryParameters":"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg","DerivedFromInstanceID":"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40","DerivedFromDocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","DerivedFromOriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","IPTCDigest":"757b10760355343c6c2ecf8f7d6e49b2","DisplayedUnitsX":"inches","DisplayedUnitsY":"inches","PrintStyle":"Centered","PrintPosition":"0 0","PrintScale":"1","GlobalAngle":"30","GlobalAltitude":"30","URL_List":"","SlicesGroupName":"ps14883_14221AE9","NumSlices":"1","PixelAspectRatio":"1","HasRealMergedData":"Yes","WriterName":"Adobe Photoshop","ReaderName":"Adobe Photoshop CS6","PhotoshopQuality":"11","PhotoshopFormat":"Standard","ProgressiveScans":"3 Scans","ProfileDescription":"sRGB IEC61966-2.1","Colorspace":"RGB","DPI":"72"},"colors":[["#D0C4B0",88.1],["#D5D4CE",8.1]],"predominant":{"google":[["gray",88.1],["white",8.1]],"cloudinary":[["gray",88.1],["white",8.1]]},"phash":"4b5b746489c99637","coordinates":{"faces":[]},"illustration_score":0.0,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":1.0},"original_filename":"9ef2320e-b0c5-4847-8f1f-2cd8181fee15"}
    timestamp 1664370914
    signature d5e820f78218f35d7663ef3e38793d0a97a763e4

    Hope that this helps.

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back and sending more details.

    So the most likely reason why the payload I sent you didn't validate is because you checked it 2 hours after it was sent which is the default time a notification is valid for. You can of course change this by passing `valid_for=86400` (valid for 1 day) to the SDK method. 

    Also, thanks for sending your test payload and the response headers, this was exactly what I was looking for and I can finally replicate it on my end. The reason I was unable to replicate previously is that the image I was using to test simply did not have enough image_metadata to trigger this error so it worked every time. 

    Now, the reason the check fails is because the payload contains linebreaks and tabs, denoted as `\n` and `\t` which is the valid way to include them but when you pass it as a string (which is the requirement), they need to be double escaped i.e. `\\n` and `\\t`. 

    After, double-escaping, the check returned valid for me e.g.

    body: {"notification_type":"upload","timestamp":"2022-09-28T13:14:57+00:00","request_id":"4054dfffb87256c4348435563f662a26","asset_id":"e5142c67f45870d977780747d249b53c","public_id":"dev/seecommerce/original/202B0021T301-CE947-F","version":1663143564,"version_id":"9646467baa0de08604a3512f47616dd5","width":1571,"height":2000,"format":"jpg","resource_type":"image","created_at":"2022-09-14T08:19:24Z","tags":[],"pages":1,"bytes":1224089,"type":"upload","etag":"38d351d7871ab92ef9f7a36006a9f8ee","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","folder":"dev/seecommerce/original","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"CodedCharacterSet":"UTF8","ApplicationRecordVersion":"4","TimeCreated":"16:22:25+00:00","DigitalCreationDate":"2020:06:29","ImageWidth":"1571","ImageHeight":"2000","BitsPerSample":"8 8 8","Compression":"LZW","PhotometricInterpretation":"RGB","Make":"Canon","Model":"Canon EOS 5D Mark III","Orientation":"Horizontal (normal)","SamplesPerPixel":"3","XResolution":"72","YResolution":"72","PlanarConfiguration":"Chunky","ResolutionUnit":"inches","Software":"Adobe Photoshop CS6 (Windows)","ModifyDate":"2020:07:21 09:09:39","ExposureTime":"1/125","FNumber":"16.0","ExposureProgram":"Manual","ISO":"100","SensitivityType":"Recommended Exposure Index","RecommendedExposureIndex":"100","ExifVersion":"0230","DateTimeOriginal":"2020:06:29 16:22:25","CreateDate":"2020:06:29 16:22:25","ShutterSpeedValue":"1/125","ApertureValue":"16.0","ExposureCompensation":"0","SubjectDistance":"0 m","MeteringMode":"Multi-segment","Flash":"Off, Did not fire","FocalLength":"70.0 mm","SubSecTimeOriginal":"59","SubSecTimeDigitized":"59","ColorSpace":"sRGB","ExifImageWidth":"1571","ExifImageHeight":"2000","FocalPlaneXResolution":"3942.505127","FocalPlaneYResolution":"3950.617188","FocalPlaneResolutionUnit":"inches","FileSource":"Digital Camera","SceneType":"Directly photographed","CustomRendered":"Normal","ExposureMode":"Manual","WhiteBalance":"Manual","SceneCaptureType":"Standard","SerialNumber":"083024003753","LensInfo":"24-70mm f/?","LensModel":"Canon EF 24-70mm f/2.8L USM","LensSerialNumber":"0000000000","ThumbnailOffset":"1026","ThumbnailLength":"2712","XMPToolkit":"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27","CreatorTool":"Adobe Photoshop CC 2017 (Macintosh)","MetadataDate":"2020:07:21 09:09:39+02:00","Lens":"Canon EF 24-70mm f/2.8L USM","FlashCompensation":"0","Firmware":"Firmware Version 1.3.5","ApproximateFocusDistance":"0","DateCreated":"2020:06:29 16:22:25.059","LegacyIPTCDigest":"FC9B262B022BCA19D69E340FFE0203A7","ColorMode":"RGB","ICCProfileName":"sRGB IEC61966-2.1","History":"2020-07-01T10:45:55+07:00\\tFile 202B0021T301CE947_SLf_UC269198.jpg opened\\n2020-07-01T10:55:56+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:25:59+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:54:56+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\\n2020-07-01T14:03:27+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif opened\\n2020-07-01T14:06:11+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved","DocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","InstanceID":"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","OriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","Format":"image/jpeg","HistoryAction":"saved, converted, derived, saved, saved, converted, derived, saved","HistoryInstanceID":"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","HistoryWhen":"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00","HistorySoftwareAgent":"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)","HistoryChanged":"/, /, /, /","HistoryParameters":"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg","DerivedFromInstanceID":"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40","DerivedFromDocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","DerivedFromOriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","IPTCDigest":"757b10760355343c6c2ecf8f7d6e49b2","DisplayedUnitsX":"inches","DisplayedUnitsY":"inches","PrintStyle":"Centered","PrintPosition":"0 0","PrintScale":"1","GlobalAngle":"30","GlobalAltitude":"30","URL_List":"","SlicesGroupName":"ps14883_14221AE9","NumSlices":"1","PixelAspectRatio":"1","HasRealMergedData":"Yes","WriterName":"Adobe Photoshop","ReaderName":"Adobe Photoshop CS6","PhotoshopQuality":"11","PhotoshopFormat":"Standard","ProgressiveScans":"3 Scans","ProfileDescription":"sRGB IEC61966-2.1","Colorspace":"RGB","DPI":"72"},"colors":[["#D0C4B0",88.1],["#D5D4CE",8.1]],"predominant":{"google":[["gray",88.1],["white",8.1]],"cloudinary":[["gray",88.1],["white",8.1]]},"phash":"4b5b746489c99637","coordinates":{"faces":[]},"illustration_score":0.0,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":1.0},"original_filename":"9ef2320e-b0c5-4847-8f1f-2cd8181fee15"}
    timestamp 1664370914 
    signature d5e820f78218f35d7663ef3e38793d0a97a763e4

    If you need to escape the double-quotes, the body would be:

    {\"notification_type\":\"upload\",\"timestamp\":\"2022-09-28T13:14:57+00:00\",\"request_id\":\"4054dfffb87256c4348435563f662a26\",\"asset_id\":\"e5142c67f45870d977780747d249b53c\",\"public_id\":\"dev/seecommerce/original/202B0021T301-CE947-F\",\"version\":1663143564,\"version_id\":\"9646467baa0de08604a3512f47616dd5\",\"width\":1571,\"height\":2000,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2022-09-14T08:19:24Z\",\"tags\":[],\"pages\":1,\"bytes\":1224089,\"type\":\"upload\",\"etag\":\"38d351d7871ab92ef9f7a36006a9f8ee\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"folder\":\"dev/seecommerce/original\",\"access_mode\":\"public\",\"overwritten\":true,\"faces\":[],\"image_metadata\":{\"CodedCharacterSet\":\"UTF8\",\"ApplicationRecordVersion\":\"4\",\"TimeCreated\":\"16:22:25+00:00\",\"DigitalCreationDate\":\"2020:06:29\",\"ImageWidth\":\"1571\",\"ImageHeight\":\"2000\",\"BitsPerSample\":\"8 8 8\",\"Compression\":\"LZW\",\"PhotometricInterpretation\":\"RGB\",\"Make\":\"Canon\",\"Model\":\"Canon EOS 5D Mark III\",\"Orientation\":\"Horizontal (normal)\",\"SamplesPerPixel\":\"3\",\"XResolution\":\"72\",\"YResolution\":\"72\",\"PlanarConfiguration\":\"Chunky\",\"ResolutionUnit\":\"inches\",\"Software\":\"Adobe Photoshop CS6 (Windows)\",\"ModifyDate\":\"2020:07:21 09:09:39\",\"ExposureTime\":\"1/125\",\"FNumber\":\"16.0\",\"ExposureProgram\":\"Manual\",\"ISO\":\"100\",\"SensitivityType\":\"Recommended Exposure Index\",\"RecommendedExposureIndex\":\"100\",\"ExifVersion\":\"0230\",\"DateTimeOriginal\":\"2020:06:29 16:22:25\",\"CreateDate\":\"2020:06:29 16:22:25\",\"ShutterSpeedValue\":\"1/125\",\"ApertureValue\":\"16.0\",\"ExposureCompensation\":\"0\",\"SubjectDistance\":\"0 m\",\"MeteringMode\":\"Multi-segment\",\"Flash\":\"Off, Did not fire\",\"FocalLength\":\"70.0 mm\",\"SubSecTimeOriginal\":\"59\",\"SubSecTimeDigitized\":\"59\",\"ColorSpace\":\"sRGB\",\"ExifImageWidth\":\"1571\",\"ExifImageHeight\":\"2000\",\"FocalPlaneXResolution\":\"3942.505127\",\"FocalPlaneYResolution\":\"3950.617188\",\"FocalPlaneResolutionUnit\":\"inches\",\"FileSource\":\"Digital Camera\",\"SceneType\":\"Directly photographed\",\"CustomRendered\":\"Normal\",\"ExposureMode\":\"Manual\",\"WhiteBalance\":\"Manual\",\"SceneCaptureType\":\"Standard\",\"SerialNumber\":\"083024003753\",\"LensInfo\":\"24-70mm f/?\",\"LensModel\":\"Canon EF 24-70mm f/2.8L USM\",\"LensSerialNumber\":\"0000000000\",\"ThumbnailOffset\":\"1026\",\"ThumbnailLength\":\"2712\",\"XMPToolkit\":\"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27\",\"CreatorTool\":\"Adobe Photoshop CC 2017 (Macintosh)\",\"MetadataDate\":\"2020:07:21 09:09:39+02:00\",\"Lens\":\"Canon EF 24-70mm f/2.8L USM\",\"FlashCompensation\":\"0\",\"Firmware\":\"Firmware Version 1.3.5\",\"ApproximateFocusDistance\":\"0\",\"DateCreated\":\"2020:06:29 16:22:25.059\",\"LegacyIPTCDigest\":\"FC9B262B022BCA19D69E340FFE0203A7\",\"ColorMode\":\"RGB\",\"ICCProfileName\":\"sRGB IEC61966-2.1\",\"History\":\"2020-07-01T10:45:55+07:00\\tFile 202B0021T301CE947_SLf_UC269198.jpg opened\\n2020-07-01T10:55:56+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:25:59+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:54:56+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\\n2020-07-01T14:03:27+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif opened\\n2020-07-01T14:06:11+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\",\"DocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"InstanceID\":\"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"OriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"Format\":\"image/jpeg\",\"HistoryAction\":\"saved, converted, derived, saved, saved, converted, derived, saved\",\"HistoryInstanceID\":\"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"HistoryWhen\":\"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00\",\"HistorySoftwareAgent\":\"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)\",\"HistoryChanged\":\"/, /, /, /\",\"HistoryParameters\":\"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg\",\"DerivedFromInstanceID\":\"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40\",\"DerivedFromDocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"DerivedFromOriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"IPTCDigest\":\"757b10760355343c6c2ecf8f7d6e49b2\",\"DisplayedUnitsX\":\"inches\",\"DisplayedUnitsY\":\"inches\",\"PrintStyle\":\"Centered\",\"PrintPosition\":\"0 0\",\"PrintScale\":\"1\",\"GlobalAngle\":\"30\",\"GlobalAltitude\":\"30\",\"URL_List\":\"\",\"SlicesGroupName\":\"ps14883_14221AE9\",\"NumSlices\":\"1\",\"PixelAspectRatio\":\"1\",\"HasRealMergedData\":\"Yes\",\"WriterName\":\"Adobe Photoshop\",\"ReaderName\":\"Adobe Photoshop CS6\",\"PhotoshopQuality\":\"11\",\"PhotoshopFormat\":\"Standard\",\"ProgressiveScans\":\"3 Scans\",\"ProfileDescription\":\"sRGB IEC61966-2.1\",\"Colorspace\":\"RGB\",\"DPI\":\"72\"},\"colors\":[[\"#D0C4B0\",88.1],[\"#D5D4CE\",8.1]],\"predominant\":{\"google\":[[\"gray\",88.1],[\"white\",8.1]],\"cloudinary\":[[\"gray\",88.1],[\"white\",8.1]]},\"phash\":\"4b5b746489c99637\",\"coordinates\":{\"faces\":[]},\"illustration_score\":0.0,\"semi_transparent\":false,\"grayscale\":false,\"quality_analysis\":{\"focus\":1.0},\"original_filename\":\"9ef2320e-b0c5-4847-8f1f-2cd8181fee15\"}

    This check also was valid for me. 

    So going forward, I would recommend:

    - First, look for backslashes and double escape them if any like my example above
    - Then escape quotes if necessary

    I'm not sure if the circe library you use supports this but there are other Java modules that can correctly stringify json objects e.g. https://stackoverflow.com/questions/5245840/how-to-convert-jsonstring-to-jsonobject-in-java

    Please do not hesitate to ask me any other questions or queries.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hello Thomas,

     

    I just try what you suggest but the validation is still not working.

     

    Here a recent example:

    {"notification_type":"upload","timestamp":"2022-09-29T09:04:54+00:00","request_id":"f58e0234781b76ecc9c17708ca72bcee","asset_id":"e5142c67f45870d977780747d249b53c","public_id":"dev/seecommerce/original/202B0021T301-CE947-F","version":1663143564,"version_id":"9646467baa0de08604a3512f47616dd5","width":1571,"height":2000,"format":"jpg","resource_type":"image","created_at":"2022-09-14T08:19:24Z","tags":[],"pages":1,"bytes":1224089,"type":"upload","etag":"38d351d7871ab92ef9f7a36006a9f8ee","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg","folder":"dev/seecommerce/original","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"CodedCharacterSet":"UTF8","ApplicationRecordVersion":"4","TimeCreated":"16:22:25+00:00","DigitalCreationDate":"2020:06:29","ImageWidth":"1571","ImageHeight":"2000","BitsPerSample":"8 8 8","Compression":"LZW","PhotometricInterpretation":"RGB","Make":"Canon","Model":"Canon EOS 5D Mark III","Orientation":"Horizontal (normal)","SamplesPerPixel":"3","XResolution":"72","YResolution":"72","PlanarConfiguration":"Chunky","ResolutionUnit":"inches","Software":"Adobe Photoshop CS6 (Windows)","ModifyDate":"2020:07:21 09:09:39","ExposureTime":"1/125","FNumber":"16.0","ExposureProgram":"Manual","ISO":"100","SensitivityType":"Recommended Exposure Index","RecommendedExposureIndex":"100","ExifVersion":"0230","DateTimeOriginal":"2020:06:29 16:22:25","CreateDate":"2020:06:29 16:22:25","ShutterSpeedValue":"1/125","ApertureValue":"16.0","ExposureCompensation":"0","SubjectDistance":"0 m","MeteringMode":"Multi-segment","Flash":"Off, Did not fire","FocalLength":"70.0 mm","SubSecTimeOriginal":"59","SubSecTimeDigitized":"59","ColorSpace":"sRGB","ExifImageWidth":"1571","ExifImageHeight":"2000","FocalPlaneXResolution":"3942.505127","FocalPlaneYResolution":"3950.617188","FocalPlaneResolutionUnit":"inches","FileSource":"Digital Camera","SceneType":"Directly photographed","CustomRendered":"Normal","ExposureMode":"Manual","WhiteBalance":"Manual","SceneCaptureType":"Standard","SerialNumber":"083024003753","LensInfo":"24-70mm f/?","LensModel":"Canon EF 24-70mm f/2.8L USM","LensSerialNumber":"0000000000","ThumbnailOffset":"1026","ThumbnailLength":"2712","XMPToolkit":"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27","CreatorTool":"Adobe Photoshop CC 2017 (Macintosh)","MetadataDate":"2020:07:21 09:09:39+02:00","Lens":"Canon EF 24-70mm f/2.8L USM","FlashCompensation":"0","Firmware":"Firmware Version 1.3.5","ApproximateFocusDistance":"0","DateCreated":"2020:06:29 16:22:25.059","LegacyIPTCDigest":"FC9B262B022BCA19D69E340FFE0203A7","ColorMode":"RGB","ICCProfileName":"sRGB IEC61966-2.1","History":"2020-07-01T10:45:55+07:00tFile 202B0021T301CE947_SLf_UC269198.jpg openedn2020-07-01T10:55:56+07:00tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb savedn2020-07-01T11:25:59+07:00tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb savedn2020-07-01T11:54:56+07:00tFile 202B0021T301CE947_SLf_UC269198.tif savedn2020-07-01T14:03:27+07:00tFile 202B0021T301CE947_SLf_UC269198.tif openedn2020-07-01T14:06:11+07:00tFile 202B0021T301CE947_SLf_UC269198.tif saved","DocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","InstanceID":"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","OriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","Format":"image/jpeg","HistoryAction":"saved, converted, derived, saved, saved, converted, derived, saved","HistoryInstanceID":"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40","HistoryWhen":"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00","HistorySoftwareAgent":"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)","HistoryChanged":"/, /, /, /","HistoryParameters":"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg","DerivedFromInstanceID":"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40","DerivedFromDocumentID":"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc","DerivedFromOriginalDocumentID":"A582795E5DDCE3F4790743E30B06752A","IPTCDigest":"757b10760355343c6c2ecf8f7d6e49b2","DisplayedUnitsX":"inches","DisplayedUnitsY":"inches","PrintStyle":"Centered","PrintPosition":"0 0","PrintScale":"1","GlobalAngle":"30","GlobalAltitude":"30","URL_List":"","SlicesGroupName":"ps14883_14221AE9","NumSlices":"1","PixelAspectRatio":"1","HasRealMergedData":"Yes","WriterName":"Adobe Photoshop","ReaderName":"Adobe Photoshop CS6","PhotoshopQuality":"11","PhotoshopFormat":"Standard","ProgressiveScans":"3 Scans","ProfileDescription":"sRGB IEC61966-2.1","Colorspace":"RGB","DPI":"72"},"colors":[["#D0C4B0",88.1],["#D5D4CE",8.1]],"predominant":{"google":[["gray",88.1],["white",8.1]],"cloudinary":[["gray",88.1],["white",8.1]]},"phash":"4b5b746489c99637","coordinates":{"faces":[]},"illustration_score":0.0,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":1.0},"original_filename":"9ef2320e-b0c5-4847-8f1f-2cd8181fee15"} 
    timestamp 1664442296
    signature a9e4fcae8d84a2520a3a3ac9c82b97f42a5e26f8 

    My code now is deleting the escape character in this way.

    val notificationJson =
    notification.noSpaces.replace("\\", "").replace("\\n", "").replace("\\t", "")


    Can I help you in some other ways?

    Best regards,

     

    Alberto

    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Antonio,

    Thanks for getting back. 

    So you do not want to remove the linebreaks and tab notations completely - you should instead double-escape them. 

    e.g.

    {\"notification_type\":\"upload\",\"timestamp\":\"2022-09-29T09:04:54+00:00\",\"request_id\":\"f58e0234781b76ecc9c17708ca72bcee\",\"asset_id\":\"e5142c67f45870d977780747d249b53c\",\"public_id\":\"dev/seecommerce/original/202B0021T301-CE947-F\",\"version\":1663143564,\"version_id\":\"9646467baa0de08604a3512f47616dd5\",\"width\":1571,\"height\":2000,\"format\":\"jpg\",\"resource_type\":\"image\",\"created_at\":\"2022-09-14T08:19:24Z\",\"tags\":[],\"pages\":1,\"bytes\":1224089,\"type\":\"upload\",\"etag\":\"38d351d7871ab92ef9f7a36006a9f8ee\",\"placeholder\":false,\"url\":\"http://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"secure_url\":\"https://media.brunellocucinelli.com/image/upload/v1663143564/dev/seecommerce/original/202B0021T301-CE947-F.jpg\",\"folder\":\"dev/seecommerce/original\",\"access_mode\":\"public\",\"overwritten\":true,\"faces\":[],\"image_metadata\":{\"CodedCharacterSet\":\"UTF8\",\"ApplicationRecordVersion\":\"4\",\"TimeCreated\":\"16:22:25+00:00\",\"DigitalCreationDate\":\"2020:06:29\",\"ImageWidth\":\"1571\",\"ImageHeight\":\"2000\",\"BitsPerSample\":\"8 8 8\",\"Compression\":\"LZW\",\"PhotometricInterpretation\":\"RGB\",\"Make\":\"Canon\",\"Model\":\"Canon EOS 5D Mark III\",\"Orientation\":\"Horizontal (normal)\",\"SamplesPerPixel\":\"3\",\"XResolution\":\"72\",\"YResolution\":\"72\",\"PlanarConfiguration\":\"Chunky\",\"ResolutionUnit\":\"inches\",\"Software\":\"Adobe Photoshop CS6 (Windows)\",\"ModifyDate\":\"2020:07:21 09:09:39\",\"ExposureTime\":\"1/125\",\"FNumber\":\"16.0\",\"ExposureProgram\":\"Manual\",\"ISO\":\"100\",\"SensitivityType\":\"Recommended Exposure Index\",\"RecommendedExposureIndex\":\"100\",\"ExifVersion\":\"0230\",\"DateTimeOriginal\":\"2020:06:29 16:22:25\",\"CreateDate\":\"2020:06:29 16:22:25\",\"ShutterSpeedValue\":\"1/125\",\"ApertureValue\":\"16.0\",\"ExposureCompensation\":\"0\",\"SubjectDistance\":\"0 m\",\"MeteringMode\":\"Multi-segment\",\"Flash\":\"Off, Did not fire\",\"FocalLength\":\"70.0 mm\",\"SubSecTimeOriginal\":\"59\",\"SubSecTimeDigitized\":\"59\",\"ColorSpace\":\"sRGB\",\"ExifImageWidth\":\"1571\",\"ExifImageHeight\":\"2000\",\"FocalPlaneXResolution\":\"3942.505127\",\"FocalPlaneYResolution\":\"3950.617188\",\"FocalPlaneResolutionUnit\":\"inches\",\"FileSource\":\"Digital Camera\",\"SceneType\":\"Directly photographed\",\"CustomRendered\":\"Normal\",\"ExposureMode\":\"Manual\",\"WhiteBalance\":\"Manual\",\"SceneCaptureType\":\"Standard\",\"SerialNumber\":\"083024003753\",\"LensInfo\":\"24-70mm f/?\",\"LensModel\":\"Canon EF 24-70mm f/2.8L USM\",\"LensSerialNumber\":\"0000000000\",\"ThumbnailOffset\":\"1026\",\"ThumbnailLength\":\"2712\",\"XMPToolkit\":\"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27\",\"CreatorTool\":\"Adobe Photoshop CC 2017 (Macintosh)\",\"MetadataDate\":\"2020:07:21 09:09:39+02:00\",\"Lens\":\"Canon EF 24-70mm f/2.8L USM\",\"FlashCompensation\":\"0\",\"Firmware\":\"Firmware Version 1.3.5\",\"ApproximateFocusDistance\":\"0\",\"DateCreated\":\"2020:06:29 16:22:25.059\",\"LegacyIPTCDigest\":\"FC9B262B022BCA19D69E340FFE0203A7\",\"ColorMode\":\"RGB\",\"ICCProfileName\":\"sRGB IEC61966-2.1\",\"History\":\"2020-07-01T10:45:55+07:00\\tFile 202B0021T301CE947_SLf_UC269198.jpg opened\\n2020-07-01T10:55:56+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:25:59+07:00\\tFile _202B0021T301CE947_SLf_UC269198D250CE1F7C160B5591F52BCA9E77BBB8.psb saved\\n2020-07-01T11:54:56+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\\n2020-07-01T14:03:27+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif opened\\n2020-07-01T14:06:11+07:00\\tFile 202B0021T301CE947_SLf_UC269198.tif saved\",\"DocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"InstanceID\":\"xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"OriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"Format\":\"image/jpeg\",\"HistoryAction\":\"saved, converted, derived, saved, saved, converted, derived, saved\",\"HistoryInstanceID\":\"xmp.iid:29A50E4A212068118083C9347BD6D104, xmp.iid:2AA50E4A212068118083C9347BD6D104, xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40, xmp.iid:A28A0B1A21CBEA11A45CFC46BCD36F40\",\"HistoryWhen\":\"2020:07:01 11:54:56+07:00, 2020:07:01 11:54:56+07:00, 2020:07:21 09:09:39+02:00, 2020:07:21 09:09:39+02:00\",\"HistorySoftwareAgent\":\"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)\",\"HistoryChanged\":\"/, /, /, /\",\"HistoryParameters\":\"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg\",\"DerivedFromInstanceID\":\"xmp.iid:A18A0B1A21CBEA11A45CFC46BCD36F40\",\"DerivedFromDocumentID\":\"adobe:docid:photoshop:b2729241-6a33-154e-893e-ab6b91d2b6fc\",\"DerivedFromOriginalDocumentID\":\"A582795E5DDCE3F4790743E30B06752A\",\"IPTCDigest\":\"757b10760355343c6c2ecf8f7d6e49b2\",\"DisplayedUnitsX\":\"inches\",\"DisplayedUnitsY\":\"inches\",\"PrintStyle\":\"Centered\",\"PrintPosition\":\"0 0\",\"PrintScale\":\"1\",\"GlobalAngle\":\"30\",\"GlobalAltitude\":\"30\",\"URL_List\":\"\",\"SlicesGroupName\":\"ps14883_14221AE9\",\"NumSlices\":\"1\",\"PixelAspectRatio\":\"1\",\"HasRealMergedData\":\"Yes\",\"WriterName\":\"Adobe Photoshop\",\"ReaderName\":\"Adobe Photoshop CS6\",\"PhotoshopQuality\":\"11\",\"PhotoshopFormat\":\"Standard\",\"ProgressiveScans\":\"3 Scans\",\"ProfileDescription\":\"sRGB IEC61966-2.1\",\"Colorspace\":\"RGB\",\"DPI\":\"72\"},\"colors\":[[\"#D0C4B0\",88.1],[\"#D5D4CE\",8.1]],\"predominant\":{\"google\":[[\"gray\",88.1],[\"white\",8.1]],\"cloudinary\":[[\"gray\",88.1],[\"white\",8.1]]},\"phash\":\"4b5b746489c99637\",\"coordinates\":{\"faces\":[]},\"illustration_score\":0.0,\"semi_transparent\":false,\"grayscale\":false,\"quality_analysis\":{\"focus\":1.0},\"original_filename\":\"9ef2320e-b0c5-4847-8f1f-2cd8181fee15\"}

    I'm not sure if the below snippet is correct but it should be something like:

    val notificationJson =
    notification.noSpaces.replace("\n", "\\n").replace("\t", "\\t")

    Please let me know if you have any other questions or queries.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink
  • Avatar
    CloudAccount WARDA

    Hi Thomas,

     

    I try with your suggestion but I'm still having the same issue.

     
    CloudinaryClient.verifySignature with body: {"notification_type":"upload","timestamp":"2022-10-03T08:08:58+00:00","request_id":"7bf9237256f311b93e6f98b68975b153","asset_id":"32f9fdf4cefbd33fc194e2e41ec8a972","public_id":"dev/seecommerce/original/202B289LP106-C2005-F","version":1663316402,"version_id":"b2e91ce9996e05a9b858fb6007e34b5b","width":1571,"height":2000,"format":"jpg","resource_type":"image","created_at":"2022-09-16T08:20:02Z","tags":[],"pages":1,"bytes":1196296,"type":"upload","etag":"a061988ab245a36dcbdfddf677609b82","placeholder":false,"url":"http://media.brunellocucinelli.com/image/upload/v1663316402/dev/seecommerce/original/202B289LP106-C2005-F.jpg","secure_url":"https://media.brunellocucinelli.com/image/upload/v1663316402/dev/seecommerce/original/202B289LP106-C2005-F.jpg","folder":"dev/seecommerce/original","access_mode":"public","overwritten":true,"faces":[],"image_metadata":{"CodedCharacterSet":"UTF8","ApplicationRecordVersion":"4","TimeCreated":"10:27:27+00:00","DigitalCreationDate":"2020:10:02","ImageWidth":"1571","ImageHeight":"2000","BitsPerSample":"8 8 8","Compression":"LZW","PhotometricInterpretation":"RGB","Make":"Canon","Model":"Canon EOS 5D Mark II","Orientation":"Horizontal (normal)","SamplesPerPixel":"3","XResolution":"72","YResolution":"72","PlanarConfiguration":"Chunky","ResolutionUnit":"inches","Software":"Adobe Photoshop CS6 (Windows)","ModifyDate":"2020:10:08 09:53:32","ExposureTime":"1/125","FNumber":"14.0","ExposureProgram":"Manual","ISO":"200","ExifVersion":"0230","DateTimeOriginal":"2020:10:02 10:27:27","CreateDate":"2020:10:02 10:27:27","ShutterSpeedValue":"1/125","ApertureValue":"14.0","ExposureCompensation":"0","SubjectDistance":"0 m","MeteringMode":"Multi-segment","Flash":"Off, Did not fire","FocalLength":"40.0 mm","SubSecTimeOriginal":"97","SubSecTimeDigitized":"97","ColorSpace":"sRGB","ExifImageWidth":"1571","ExifImageHeight":"2000","FocalPlaneXResolution":"3849.21167","FocalPlaneYResolution":"3908.141846","FocalPlaneResolutionUnit":"inches","FileSource":"Digital Camera","SceneType":"Directly photographed","CustomRendered":"Normal","ExposureMode":"Manual","WhiteBalance":"Auto","SceneCaptureType":"Standard","SerialNumber":"320212795","LensModel":"Canon EF 24-105mm f/4L IS USM","ThumbnailOffset":"934","ThumbnailLength":"2693","XMPToolkit":"Adobe XMP Core 5.3-c011 66.145661, 2012/02/06-14:56:27","Lens":"Canon EF 24-105mm f/4L IS USM","FlashCompensation":"0","Firmware":"Firmware Version 1.0.6","ApproximateFocusDistance":"0","DateCreated":"2020:10:02 10:27:27.097","LegacyIPTCDigest":"C9DE62709307DC061208249FB8A16CF7","ColorMode":"RGB","ICCProfileName":"sRGB IEC61966-2.1","CreatorTool":"Adobe Photoshop CC 2018 (Macintosh)","MetadataDate":"2020:10:08 09:53:32+02:00","DocumentID":"adobe:docid:photoshop:25855a77-ae53-f94c-b951-50819e7c0e90","InstanceID":"xmp.iid:81C773523B09EB11B5D8E6C7487C7473","OriginalDocumentID":"498322A09D3C2AF47455C790AD2BBEBF","Format":"image/jpeg","HistoryAction":"saved, converted, derived, saved, saved, converted, derived, saved","HistoryInstanceID":"xmp.iid:EC5331C31D2068118083DD1CC5D40B4E, xmp.iid:ED5331C31D2068118083DD1CC5D40B4E, xmp.iid:80C773523B09EB11B5D8E6C7487C7473, xmp.iid:81C773523B09EB11B5D8E6C7487C7473","HistoryWhen":"2020:10:03 06:00:59-07:00, 2020:10:03 06:00:59-07:00, 2020:10:08 09:53:32+02:00, 2020:10:08 09:53:32+02:00","HistorySoftwareAgent":"Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Macintosh), Adobe Photoshop CS6 (Windows), Adobe Photoshop CS6 (Windows)","HistoryChanged":"/, /, /, /","HistoryParameters":"from image/jpeg to image/tiff, converted from image/jpeg to image/tiff, from image/tiff to image/jpeg, converted from image/tiff to image/jpeg","DerivedFromInstanceID":"xmp.iid:80C773523B09EB11B5D8E6C7487C7473","DerivedFromDocumentID":"adobe:docid:photoshop:25855a77-ae53-f94c-b951-50819e7c0e90","DerivedFromOriginalDocumentID":"498322A09D3C2AF47455C790AD2BBEBF","IPTCDigest":"d8e8e6809bddc3a67516b113ce2f1fab","DisplayedUnitsX":"inches","DisplayedUnitsY":"inches","PrintStyle":"Centered","PrintPosition":"0 0","PrintScale":"1","GlobalAngle":"30","GlobalAltitude":"30","URL_List":"","SlicesGroupName":"ps14883_7B692607","NumSlices":"1","PixelAspectRatio":"1","HasRealMergedData":"Yes","WriterName":"Adobe Photoshop","ReaderName":"Adobe Photoshop CS6","PhotoshopQuality":"11","PhotoshopFormat":"Standard","ProgressiveScans":"3 Scans","ProfileDescription":"sRGB IEC61966-2.1","Colorspace":"RGB","DPI":"72"},"colors":[["#CEC2B1",73.7],["#B88254",19.9],["#9E683F",5.6]],"predominant":{"google":[["gray",73.7],["orange",19.9],["brown",5.6]],"cloudinary":[["gray",73.7],["brown",25.5]]},"phash":"d3c3f14e34cc3c32","coordinates":{"faces":[]},"illustration_score":0.0,"semi_transparent":false,"grayscale":false,"quality_analysis":{"focus":0.8767565488815308},"original_filename":"642a50c8-963a-43ad-8c30-ca8d4e734016"},
    timestamp 1664784539 and
    signature 2feed818d5bb250f648ca3e614f65ed30b1c4283 
     
     
    But just one point, why Am I getting issue just with this customer account? Cannot be something related with the configuration?

    Best regards,
     
    Alberto
     
     
     
    0
    Comment actions Permalink
  • Avatar
    Thomas Gurung

    Hi Alberto,

    Thanks for getting back. 

    So I just tested with the payload you sent and it was valid. I had to of course pass `valid_for=129600` param as the notification was sent over a day ago and is only valid for 2 hours by default.

    Do you want to submit a ticket via https://support.cloudinary.com/hc/en-us/requests/new and reference this post? Then we can continue investigating there. 

    At this point, the issue looks to be your end as I can't replicate when using the correct data.

    I'm looking forward to your response.

    Kind Regards,
    Thomas

    0
    Comment actions Permalink

Please sign in to leave a comment.