[JWT] Error create token when another extension also use BouncyCastle.Crypto.dll

Forge Component
(8)
Published on 2018-10-10 by João Almeida
8 votes
Published on 2018-10-10 by João Almeida

I have error creating asymmetric token when I have another extension dependency which also use BouncyCaslte.Crypto.dll. The error stack is:

[1] Could not load file or assembly 'BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at ssJWT.RssExtensionJWT_Core.MssCreateToken(HeContext heContext, IRecord inParamSymmetricCredentials, IRecord inParamAsymmetricCredentials, IRecord inParamPayload, String& outParamResultMessage, String& outParamPlainToken, String& outParamSignedAndEncodedToken)
   at ssJWT.Actions.ActionCreateSignedAsymmetricTokenWithPemKey(HeContext heContext, Int32 inParamAlgorithm, String inParamKeyId, String inParamPrivateKey, String inParamPrivateKeyPassword, String inParamTokenId, String inParamIssuer, String inParamSubject, String inParamAudience, DateTime inParamExpiration, DateTime inParamNotBefore, DateTime inParamIssuedAt, RLClaimRecordList inParamClaims, Boolean& outParamSuccess, String& outParamResultMessage, String& outParamPlainToken, String& outParamSignedAndEncodedToken)

[2] The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


But the other extension dependency can function without any error.

Did you check if the extensions use different versions of BouncyCastle? If they are different, It might be the cause of the problem. If so and you still want to use these extensions, you can check if they have versions that use the same version of BouncyCastle, or if you can do that change in the extension itself.

Guilherme Barbosa wrote:

Did you check if the extensions use different versions of BouncyCastle? If they are different, It might be the cause of the problem. If so and you still want to use these extensions, you can check if they have versions that use the same version of BouncyCastle, or if you can do that change in the extension itself.

How do I check? 


But the other extension dependency can function without any error. If different version why would it not affect the other extension?


Meng Wye, Lavin Lim wrote:

Guilherme Barbosa wrote:

Did you check if the extensions use different versions of BouncyCastle? If they are different, It might be the cause of the problem. If so and you still want to use these extensions, you can check if they have versions that use the same version of BouncyCastle, or if you can do that change in the extension itself.

How do I check? 


But the other extension dependency can function without any error. If different version why would it not affect the other extension?


  1. Open the application of the extension and click on the extension (in this case, JWT_Core) to open integration studio;
  2. When it is opened, go to File menu (upper left corner) and select edit code .NET;
  3. Click on the reference .dll to see the version.

For JWT, I get:


As you can see, versions are indeed different. Try to use the same as in the other extension and to update the extension if it is not too complicated.


JWT in Forge currently is using 1.8.3, but in the upcoming version to be released it will be upgraded to 1.8.5.