projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef2f4f2
)
fix-38054
author
Egor Bogatov
<egorbo@gmail.com>
Thu, 14 Sep 2017 17:36:59 +0000
(19:36 +0200)
committer
Marek Safar
<marek.safar@gmail.com>
Wed, 20 Sep 2017 12:34:13 +0000
(14:34 +0200)
mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
patch
|
blob
|
history
mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
patch
|
blob
|
history
diff --git
a/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
b/mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
index a8ebc812da3aff1068f07cb3114b0099cdc870a0..16fdfa15e5eb7a9d3b191fa793c83a036e558b7b 100644
(file)
--- a/
mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
+++ b/
mcs/class/corlib/System.Security.Cryptography/RSACryptoServiceProvider.cs
@@
-111,6
+111,7
@@
namespace System.Security.Cryptography {
store = new KeyPairPersistence (p);
bool exists = store.Load ();
bool required = (p.Flags & CspProviderFlags.UseExistingKey) != 0;
store = new KeyPairPersistence (p);
bool exists = store.Load ();
bool required = (p.Flags & CspProviderFlags.UseExistingKey) != 0;
+ privateKeyExportable = (p.Flags & CspProviderFlags.UseNonExportableKey) == 0;
if (required && !exists)
throw new CryptographicException ("Keyset does not exist");
if (required && !exists)
throw new CryptographicException ("Keyset does not exist");
diff --git
a/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
b/mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
index 6e44e3235b24061c7626bc48311a4cacbf686184..c9011cb41f6f9a37736eb9d0ba9e89d39e203b67 100644
(file)
--- a/
mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
+++ b/
mcs/class/corlib/Test/System.Security.Cryptography/RSACryptoServiceProviderTest.cs
@@
-1403,6
+1403,16
@@
public class RSACryptoServiceProviderTest {
rsa = new RSACryptoServiceProvider (minKeySize);
rsa.ImportCspBlob (blob);
}
rsa = new RSACryptoServiceProvider (minKeySize);
rsa.ImportCspBlob (blob);
}
+
+ [Test] //bug 38054
+ public void NonExportableKeysAreNonExportable ()
+ {
+ var cspParams = new CspParameters();
+ cspParams.KeyContainerName = "TestRSAKey";
+ cspParams.Flags = CspProviderFlags.UseNonExportableKey;
+ var rsa = new RSACryptoServiceProvider(cspParams);
+ Assert.Throws<CryptographicException>(() => rsa.ExportParameters(true));
+ }
}
}
}
}