public void SnPublicKeyIsReturnedAsIs() { var key = ImmutableArray.Create(TestResources.General.snPublicKey); ImmutableArray <byte> pubKey; Assert.True(CryptoBlobParser.TryParseKey(key, out pubKey, out _)); Assert.True(CryptoBlobParser.IsValidPublicKey(pubKey)); AssertEx.Equal(key, pubKey); }
public void GetPublicKeyFromKeyPair2() { var key = ImmutableArray.Create(TestResources.General.snKey2); ImmutableArray <byte> pubKey; Assert.True(CryptoBlobParser.TryParseKey(key, out pubKey, out _)); Assert.True(CryptoBlobParser.IsValidPublicKey(pubKey)); AssertEx.Equal(TestResources.General.snPublicKey2, pubKey); }
public void GetSnPublicKeyFromPublicKeyBlob() { // An Strongname public key blob includes an additional header on top // of the wincrypt.h public key blob var snBlob = TestResources.General.snPublicKey; var buf = new byte[snBlob.Length - CryptoBlobParser.s_publicKeyHeaderSize]; Array.Copy(snBlob, CryptoBlobParser.s_publicKeyHeaderSize, buf, 0, buf.Length); var publicKeyBlob = ImmutableArray.Create(buf); ImmutableArray <byte> pubKey; Assert.True(CryptoBlobParser.TryParseKey(publicKeyBlob, out pubKey, out _)); Assert.True(CryptoBlobParser.IsValidPublicKey(pubKey)); AssertEx.Equal(snBlob, pubKey); }