You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using Senparc.Weixin.TenPayV3.Helpers;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Senparc.Weixin.TenPayV3.Test.net6.Helpers
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class ApiSecurityHelperTests
|
|
|
|
|
{
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void GetUnwrapCertKeyTest()
|
|
|
|
|
{
|
|
|
|
|
var originalPublicKey = @"-----BEGIN PUBLIC KEY-----
|
|
|
|
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4zej1cqugGQtVSY2Ah8R
|
|
|
|
|
MCKcr2UpZ8Npo+5Ja9xpFPYkWHaF1Gjrn3d5kcwAFuHHcfdc3yxDYx6+9grvJnCA
|
|
|
|
|
2zQzWjzVRa3BJ5LTMj6yqvhEmtvjO9D1xbFTA2m3kyjxlaIar/RYHZSslT4VmjIa
|
|
|
|
|
tW9KJCDKkwpM6x/RIWL8wwfFwgz2q3Zcrff1y72nB8p8P12ndH7GSLoY6d2Tv0OB
|
|
|
|
|
2+We2Kyy2+QzfGXOmLp7UK/pFQjJjzhSf9jxaWJXYKIBxpGlddbRZj9PqvFPTiep
|
|
|
|
|
8rvfKGNZF9Q6QaMYTpTp/uKQ3YvpDlyeQlYe4rRFauH3mOE6j56QlYQWivknDX9V
|
|
|
|
|
rwIDAQAB
|
|
|
|
|
-----END PUBLIC KEY-----";
|
|
|
|
|
|
|
|
|
|
var unwrapKey = SecurityHelper.GetUnwrapCertKey(originalPublicKey);
|
|
|
|
|
Assert.AreEqual(@"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8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