C#: Convert CreateSymmetricKey to CSV sink.

This commit is contained in:
Michael Nebel
2022-06-21 15:51:33 +02:00
parent 1d405dba14
commit 032448041d

View File

@@ -52,7 +52,8 @@ module HardcodedSymmetricEncryptionKey {
row =
[
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateEncryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-encryptor",
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateDecryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-decryptor"
"System.Security.Cryptography;SymmetricAlgorithm;true;CreateDecryptor;(System.Byte[],System.Byte[]);;Argument[0];encryption-decryptor",
"Windows.Security.Cryptography.Core;SymmetricKeyAlgorithmProvider;false;CreateSymmetricKey;(Windows.Storage.Streams.IBuffer);;Argument[0];encryption-symmetrickey"
]
}
}
@@ -66,22 +67,11 @@ module HardcodedSymmetricEncryptionKey {
kind = "encryption-encryptor" and result = "Encryptor(rgbKey, IV)"
or
kind = "encryption-decryptor" and result = "Decryptor(rgbKey, IV)"
or
kind = "encryption-symmetrickey" and result = "CreateSymmetricKey(IBuffer keyMaterial)"
}
}
private class CreateSymmetricKeySink extends Sink {
CreateSymmetricKeySink() {
exists(MethodCall mc, Method m |
mc.getTarget() = m and
m.hasQualifiedName("Windows.Security.Cryptography.Core.SymmetricKeyAlgorithmProvider",
"CreateSymmetricKey") and
this.asExpr() = mc.getArgumentForName("keyMaterial")
)
}
override string getDescription() { result = "CreateSymmetricKey(IBuffer keyMaterial)" }
}
private class CryptographicBuffer extends Class {
CryptographicBuffer() {
this.hasQualifiedName("Windows.Security.Cryptography", "CryptographicBuffer")