IS_OBJECTSIGNED (Transact-SQL)
Indica se un oggetto viene firmato da una chiave asimmetrica o da un certificato specificato.
Sintassi
IS_OBJECTSIGNED (
'OBJECT', @object_id, @class, @thumbprint
)
Argomenti
'OBJECT'
Tipo di classe a protezione diretta.@object\_id
object_id dell'oggetto sottoposto a test. @object\_id è di tipo int.@class
Classe dell'oggetto.'certificate'
'asymmetric key'
@class è di tipo sysname.
@thumbprint
Identificazione digitale SHA dell'oggetto. @thumbprint è di tipo varbinary(32).
Tipi restituiti
int
Osservazioni
IS_OBJECTSIGNED restituisce i valori seguenti.
Valore restituito |
Descrizione |
---|---|
0 |
L'oggetto non viene firmato. |
1 |
L'oggetto viene firmato. |
NULL |
L'oggetto non è valido. |
Autorizzazioni
È richiesta l'autorizzazione VIEW DEFINITION per il certificato o la chiave asimmetrica.
Esempi
A. Visualizzazione delle proprietà estese in un database
Nell'esempio seguente viene testato se la tabella spt_fallback_db del database master viene firmata dal certificato di firma dello schema.
USE master
-- Declare a variable to hold a thumbprint and an object name
DECLARE @thumbprint varbinary(20), @objectname sysname;
-- Populate the thumbprint variable with the thumbprint of
-- the master database schema signing certificate
SELECT @thumbprint = thumbprint
FROM sys.certificates
WHERE name LIKE '%SchemaSigningCertificate%';
-- Populate the object name variable with a table name in master
SELECT @objectname = 'spt_fallback_db';
-- Query to see if the table is signed by the thumbprint
SELECT @objectname AS [object name],
IS_OBJECTSIGNED(
'OBJECT', OBJECT_ID(@objectname), 'certificate', @thumbprint
) AS [Is the object signed?] ;