|
1 | 1 | --- |
2 | 2 | title: "ALTER ASYMMETRIC KEY (Transact-SQL) | Microsoft Docs" |
3 | 3 | ms.custom: "" |
4 | | -ms.date: "03/14/2017" |
| 4 | +ms.date: "04/12/2017" |
5 | 5 | ms.prod: "sql-non-specified" |
6 | 6 | ms.reviewer: "" |
7 | 7 | ms.suite: "" |
@@ -30,100 +30,99 @@ manager: "jhubbard" |
30 | 30 | # ALTER ASYMMETRIC KEY (Transact-SQL) |
31 | 31 | [!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)] |
32 | 32 |
|
33 | | - Changes the properties of an asymmetric key. |
34 | | - |
35 | | -  [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) |
36 | | - |
37 | | -## Syntax |
38 | | - |
39 | | -``` |
40 | | - |
41 | | -ALTER ASYMMETRIC KEY Asym_Key_Name <alter_option> |
42 | | - |
43 | | -<alter_option> ::= |
44 | | - <password_change_option> |
45 | | - | |
46 | | - REMOVE PRIVATE KEY |
47 | | -<password_change_option> ::= |
48 | | - WITH PRIVATE KEY ( <password_option> [ , <password_option> ] ) |
49 | | -<password_option> ::= |
50 | | - ENCRYPTION BY PASSWORD = 'strongPassword' |
51 | | - | |
52 | | - DECRYPTION BY PASSWORD = 'oldPassword' |
53 | | -``` |
54 | | - |
55 | | -## Arguments |
56 | | - *Asym_Key_Name* |
57 | | - Is the name by which the asymmetric key is known in the database. |
58 | | - |
59 | | - REMOVE PRIVATE KEY |
60 | | - Removes the private key from the asymmetric key The public key is not removed. |
61 | | - |
62 | | - WITH PRIVATE KEY |
63 | | - Changes the protection of the private key. |
64 | | - |
65 | | - ENCRYPTION BY PASSWORD **='***stongPassword***'** |
66 | | - Specifies a new password for protecting the private key. *password* must meet the Windows password policy requirements of the computer that is running the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. If this option is omitted, the private key will be encrypted by the database master key. |
67 | | - |
68 | | - DECRYPTION BY PASSWORD **='***oldPassword***'** |
69 | | - Specifies the old password, with which the private key is currently protected. Is not required if the private key is encrypted with the database master key. |
70 | | - |
71 | | -## Remarks |
72 | | - If there is no database master key the ENCRYPTION BY PASSWORD option is required, and the operation will fail if no password is supplied. For information about how to create a database master key, see [CREATE MASTER KEY (Transact-SQL)](../../t-sql/statements/create-master-key-transact-sql.md). |
73 | | - |
74 | | - You can use ALTER ASYMMETRIC KEY to change the protection of the private key by specifying PRIVATE KEY options as shown in the following table. |
75 | | - |
76 | | -|Change protection from|ENCRYPTION BY PASSWORD|DECRYPTION BY PASSWORD| |
77 | | -|----------------------------|----------------------------|----------------------------| |
78 | | -|Old password to new password|Required|Required| |
79 | | -|Password to master key|Omit|Required| |
80 | | -|Master key to password|Required|Omit| |
81 | | - |
82 | | - The database master key must be opened before it can be used to protect a private key. For more information, see [OPEN MASTER KEY (Transact-SQL)](../../t-sql/statements/open-master-key-transact-sql.md). |
83 | | - |
84 | | - To change the ownership of an asymmetric key, use [ALTER AUTHORIZATION](../../t-sql/statements/alter-authorization-transact-sql.md). |
85 | | - |
86 | | -## Permissions |
87 | | - Requires CONTROL permission on the asymmetric key if the private key is being removed. |
88 | | - |
89 | | -## Examples |
90 | | - |
91 | | -### A. Changing the password of the private key |
92 | | - The following example changes the password used to protect the private key of asymmetric key `PacificSales09`. The new password will be `<enterStrongPasswordHere>`. |
93 | | - |
94 | | -``` |
95 | | -ALTER ASYMMETRIC KEY PacificSales09 |
96 | | - WITH PRIVATE KEY ( |
97 | | - DECRYPTION BY PASSWORD = '<oldPassword>', |
98 | | - ENCRYPTION BY PASSWORD = '<enterStrongPasswordHere>'); |
99 | | -GO |
100 | | -``` |
101 | | - |
102 | | -### B. Removing the private key from an asymmetric key |
103 | | - The following example removes the private key from `PacificSales19`, leaving only the public key. |
104 | | - |
105 | | -``` |
106 | | -ALTER ASYMMETRIC KEY PacificSales19 REMOVE PRIVATE KEY; |
107 | | -GO |
108 | | -``` |
109 | | - |
110 | | -### C. Removing password protection from a private key |
111 | | - The following example removes the password protection from a private key and protects it with the database master key. |
112 | | - |
113 | | -``` |
114 | | -OPEN MASTER KEY; |
115 | | -ALTER ASYMMETRIC KEY PacificSales09 WITH PRIVATE KEY ( |
116 | | - DECRYPTION BY PASSWORD = '<enterStrongPasswordHere>' ); |
117 | | -GO |
118 | | -``` |
119 | | - |
120 | | -## See Also |
121 | | - [CREATE ASYMMETRIC KEY (Transact-SQL)](../../t-sql/statements/create-asymmetric-key-transact-sql.md) |
122 | | - [DROP ASYMMETRIC KEY (Transact-SQL)](../../t-sql/statements/drop-asymmetric-key-transact-sql.md) |
123 | | - [SQL Server and Database Encryption Keys (Database Engine)](../../relational-databases/security/encryption/sql-server-and-database-encryption-keys-database-engine.md) |
124 | | - [Encryption Hierarchy](../../relational-databases/security/encryption/encryption-hierarchy.md) |
125 | | - [CREATE MASTER KEY (Transact-SQL)](../../t-sql/statements/create-master-key-transact-sql.md) |
126 | | - [OPEN MASTER KEY (Transact-SQL)](../../t-sql/statements/open-master-key-transact-sql.md) |
127 | | - [Extensible Key Management (EKM)](../../relational-databases/security/encryption/extensible-key-management-ekm.md) |
128 | | - |
129 | | - |
| 33 | + Changes the properties of an asymmetric key. |
| 34 | + |
| 35 | +  [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) |
| 36 | + |
| 37 | +## Syntax |
| 38 | + |
| 39 | +``` |
| 40 | +ALTER ASYMMETRIC KEY Asym_Key_Name <alter_option> |
| 41 | + |
| 42 | +<alter_option> ::= |
| 43 | + <password_change_option> |
| 44 | + | REMOVE PRIVATE KEY |
| 45 | +
|
| 46 | +<password_change_option> ::= |
| 47 | + WITH PRIVATE KEY ( <password_option> [ , <password_option> ] ) |
| 48 | +
|
| 49 | +<password_option> ::= |
| 50 | + ENCRYPTION BY PASSWORD = 'strongPassword' |
| 51 | + | DECRYPTION BY PASSWORD = 'oldPassword' |
| 52 | +``` |
| 53 | + |
| 54 | +## Arguments |
| 55 | + *Asym_Key_Name* |
| 56 | + Is the name by which the asymmetric key is known in the database. |
| 57 | + |
| 58 | + REMOVE PRIVATE KEY |
| 59 | + Removes the private key from the asymmetric key The public key is not removed. |
| 60 | + |
| 61 | + WITH PRIVATE KEY |
| 62 | + Changes the protection of the private key. |
| 63 | + |
| 64 | + ENCRYPTION BY PASSWORD **='***stongPassword***'** |
| 65 | + Specifies a new password for protecting the private key. *password* must meet the Windows password policy requirements of the computer that is running the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. If this option is omitted, the private key will be encrypted by the database master key. |
| 66 | + |
| 67 | + DECRYPTION BY PASSWORD **='***oldPassword***'** |
| 68 | + Specifies the old password, with which the private key is currently protected. Is not required if the private key is encrypted with the database master key. |
| 69 | + |
| 70 | +## Remarks |
| 71 | + If there is no database master key the ENCRYPTION BY PASSWORD option is required, and the operation will fail if no password is supplied. For information about how to create a database master key, see [CREATE MASTER KEY (Transact-SQL)](../../t-sql/statements/create-master-key-transact-sql.md). |
| 72 | + |
| 73 | + You can use ALTER ASYMMETRIC KEY to change the protection of the private key by specifying PRIVATE KEY options as shown in the following table. |
| 74 | + |
| 75 | +|Change protection from|ENCRYPTION BY PASSWORD|DECRYPTION BY PASSWORD| |
| 76 | +|----------------------------|----------------------------|----------------------------| |
| 77 | +|Old password to new password|Required|Required| |
| 78 | +|Password to master key|Omit|Required| |
| 79 | +|Master key to password|Required|Omit| |
| 80 | + |
| 81 | + The database master key must be opened before it can be used to protect a private key. For more information, see [OPEN MASTER KEY (Transact-SQL)](../../t-sql/statements/open-master-key-transact-sql.md). |
| 82 | + |
| 83 | + To change the ownership of an asymmetric key, use [ALTER AUTHORIZATION](../../t-sql/statements/alter-authorization-transact-sql.md). |
| 84 | + |
| 85 | +## Permissions |
| 86 | + Requires CONTROL permission on the asymmetric key if the private key is being removed. |
| 87 | + |
| 88 | +## Examples |
| 89 | + |
| 90 | +### A. Changing the password of the private key |
| 91 | + The following example changes the password used to protect the private key of asymmetric key `PacificSales09`. The new password will be `<enterStrongPasswordHere>`. |
| 92 | + |
| 93 | +``` |
| 94 | +ALTER ASYMMETRIC KEY PacificSales09 |
| 95 | + WITH PRIVATE KEY ( |
| 96 | + DECRYPTION BY PASSWORD = '<oldPassword>', |
| 97 | + ENCRYPTION BY PASSWORD = '<enterStrongPasswordHere>'); |
| 98 | +GO |
| 99 | +``` |
| 100 | + |
| 101 | +### B. Removing the private key from an asymmetric key |
| 102 | + The following example removes the private key from `PacificSales19`, leaving only the public key. |
| 103 | + |
| 104 | +``` |
| 105 | +ALTER ASYMMETRIC KEY PacificSales19 REMOVE PRIVATE KEY; |
| 106 | +GO |
| 107 | +``` |
| 108 | + |
| 109 | +### C. Removing password protection from a private key |
| 110 | + The following example removes the password protection from a private key and protects it with the database master key. |
| 111 | + |
| 112 | +``` |
| 113 | +OPEN MASTER KEY; |
| 114 | +ALTER ASYMMETRIC KEY PacificSales09 WITH PRIVATE KEY ( |
| 115 | + DECRYPTION BY PASSWORD = '<enterStrongPasswordHere>' ); |
| 116 | +GO |
| 117 | +``` |
| 118 | + |
| 119 | +## See Also |
| 120 | + [CREATE ASYMMETRIC KEY (Transact-SQL)](../../t-sql/statements/create-asymmetric-key-transact-sql.md) |
| 121 | + [DROP ASYMMETRIC KEY (Transact-SQL)](../../t-sql/statements/drop-asymmetric-key-transact-sql.md) |
| 122 | + [SQL Server and Database Encryption Keys (Database Engine)](../../relational-databases/security/encryption/sql-server-and-database-encryption-keys-database-engine.md) |
| 123 | + [Encryption Hierarchy](../../relational-databases/security/encryption/encryption-hierarchy.md) |
| 124 | + [CREATE MASTER KEY (Transact-SQL)](../../t-sql/statements/create-master-key-transact-sql.md) |
| 125 | + [OPEN MASTER KEY (Transact-SQL)](../../t-sql/statements/open-master-key-transact-sql.md) |
| 126 | + [Extensible Key Management (EKM)](../../relational-databases/security/encryption/extensible-key-management-ekm.md) |
| 127 | + |
| 128 | + |
0 commit comments