Skip to content

Commit e497517

Browse files
#1 Instead of Default encoding it's using now iso-8859-1. Thanks to hippasus for noticing it.
1 parent f03968a commit e497517

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: RoyalMailApi/Engine/RoyalMailApiClient.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,18 @@ private SecurityHeaderType GetSecurityHeaderType()
8080
byte[] hashedPassword;
8181
hashedPassword = GetSHA1(_credentials.SoapSecurity.Password);
8282

83-
string concatednatedDigestInput = string.Concat(nonce, creationDate, Encoding.Default.GetString(hashedPassword));
83+
// https://github.com/povilaspanavas/RoyalMailShippingApiV2/issues/1
84+
// after hippasus raised issue, I've changed the encoding (previously was using Default). Ran the tests and it worked
85+
var encoding = Encoding.GetEncoding("iso-8859-1");
86+
string concatednatedDigestInput = string.Concat(nonce, creationDate, encoding.GetString(hashedPassword));
8487
byte[] digest;
8588
digest = GetSHA1(concatednatedDigestInput);
8689

8790
string passwordDigest;
8891
passwordDigest = Convert.ToBase64String(digest);
8992

9093
string encodedNonce;
91-
encodedNonce = Convert.ToBase64String(Encoding.Default.GetBytes(nonce));
94+
encodedNonce = Convert.ToBase64String(encoding.GetBytes(nonce));
9295

9396
XmlDocument doc = new XmlDocument();
9497
using (XmlWriter writer = doc.CreateNavigator().AppendChild())

0 commit comments

Comments
 (0)