-
Type: Improvement
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Docs Examples
-
None
-
Fully Compatible
-
Needed
Exception in thread "main" com.mongodb.MongoClientException: Exception in encryption library: decryption expected BSON binary subtype 6, got 0 at com.mongodb.client.internal.Crypt.wrapInClientException(Crypt.java:370) at com.mongodb.client.internal.Crypt.decryptExplicitly(Crypt.java:230) at com.mongodb.client.internal.ClientEncryptionImpl.decrypt(ClientEncryptionImpl.java:93) at tour.ClientSideEncryptionExplicitEncryptionAndDecryptionTour.main(ClientSideEncryptionExplicitEncryptionAndDecryptionTour.java:105) Caused by: com.mongodb.crypt.capi.MongoCryptException: decryption expected BSON binary subtype 6, got 0 at com.mongodb.crypt.capi.MongoCryptContextImpl.throwExceptionFromStatus(MongoCryptContextImpl.java:156) at com.mongodb.crypt.capi.MongoCryptImpl.configure(MongoCryptImpl.java:350) at com.mongodb.crypt.capi.MongoCryptImpl.createExplicitDecryptionContext(MongoCryptImpl.java:299) at com.mongodb.client.internal.Crypt.decryptExplicitly(Crypt.java:227) ... 2 more
It's due to the fact that when the BsonBinary instance is constructed from the Binary instance, the subtype is not preserved, so it defaults to 0.