com.microsoft.azure.keyvault.models.KeyAttributes Java Examples
The following examples show how to use
com.microsoft.azure.keyvault.models.KeyAttributes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KeyOperationsTest.java From azure-keyvault-java with MIT License | 6 votes |
private void checkImportOperation(KeyBundle keyBundle, boolean importToHardware) throws Exception { Attributes attribute = new KeyAttributes() .withEnabled(true) .withExpires(new DateTime().withYear(2050).withMonthOfYear(1)) .withNotBefore(new DateTime().withYear(2000).withMonthOfYear(1)); Map<String, String> tags = new HashMap<String, String>(); tags.put("foo", "baz"); JsonWebKey importedJwk = keyBundle.key(); KeyBundle importResultBundle = keyVaultClient.importKey( new ImportKeyRequest .Builder(getVaultUri(), KEY_NAME, keyBundle.key()) .withHsm(importToHardware) .withAttributes(attribute) .withTags(tags) .build()); validateRsaKeyBundle(importResultBundle, getVaultUri(), KEY_NAME, importToHardware ? JsonWebKeyType.RSA_HSM : JsonWebKeyType.RSA, importedJwk.keyOps(), attribute); checkEncryptDecryptSequence(importedJwk, importResultBundle); Assert.assertTrue(importResultBundle.key().isValid()); }
Example #2
Source File: UpdateKeyRequest.java From azure-keyvault-java with MIT License | 6 votes |
private UpdateKeyRequest(Builder builder) { vaultBaseUrl = builder.vaultBaseUrl; keyName = builder.keyName; keyVersion = builder.keyVersion == null ? "" : builder.keyVersion; if (builder.keyOperations != null) { keyOperations = new ArrayList<JsonWebKeyOperation>(builder.keyOperations); } else { keyOperations = null; } if (builder.attributes != null) { keyAttributes = (KeyAttributes) new KeyAttributes().withEnabled(builder.attributes.enabled()) .withExpires(builder.attributes.expires()).withNotBefore(builder.attributes.notBefore()); } else { keyAttributes = null; } if (builder.tags != null) { tags = Collections.unmodifiableMap(builder.tags); } else { tags = null; } }
Example #3
Source File: KeyVaultClientCustomImpl.java From azure-keyvault-java with MIT License | 5 votes |
@Override public Observable<ServiceResponse<KeyBundle>> createKeyWithServiceResponseAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) { return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags, null); }
Example #4
Source File: ImportKeyRequest.java From azure-keyvault-java with MIT License | 5 votes |
private ImportKeyRequest(Builder builder) { vaultBaseUrl = builder.vaultBaseUrl; keyName = builder.keyName; isHsm = builder.isHsm; if (builder.key != null) { key = new JsonWebKey().withKty(builder.key.kty()).withN(builder.key.n()).withE(builder.key.e()) .withD(builder.key.d()).withP(builder.key.p()).withQ(builder.key.q()).withDp(builder.key.dp()) .withDq(builder.key.dq()).withQi(builder.key.qi()).withK(builder.key.k()).withT(builder.key.t()); if (builder.key.keyOps() != null) { key.withKeyOps(new ArrayList<JsonWebKeyOperation>(builder.key.keyOps())); } } else { key = null; } if (builder.attributes != null) { keyAttributes = (KeyAttributes) new KeyAttributes().withNotBefore(builder.attributes.notBefore()) .withEnabled(builder.attributes.enabled()).withExpires(builder.attributes.expires()); } else { keyAttributes = null; } if (builder.tags != null) { tags = Collections.unmodifiableMap(builder.tags); } else { tags = null; } }
Example #5
Source File: CreateKeyRequest.java From azure-keyvault-java with MIT License | 5 votes |
private CreateKeyRequest(Builder builder) { vaultBaseUrl = builder.vaultBaseUrl; keyName = builder.keyName; keyType = builder.keyType; keySize = builder.keySize; if (builder.keyOperations != null) { keyOperations = new ArrayList<JsonWebKeyOperation>(builder.keyOperations); } else { keyOperations = null; } if (builder.attributes != null) { keyAttributes = (KeyAttributes) new KeyAttributes().withNotBefore(builder.attributes.notBefore()) .withEnabled(builder.attributes.enabled()).withExpires(builder.attributes.expires()); } else { keyAttributes = null; } if (builder.tags != null) { tags = Collections.unmodifiableMap(builder.tags); } else { tags = null; } if (builder.curve != null) { curve = builder.curve; } else { curve = null; } }
Example #6
Source File: KeyVaultClientCustomImpl.java From azure-keyvault-java with MIT License | 4 votes |
@Override public KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) { return createKey(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags, null); }
Example #7
Source File: KeyVaultClientCustomImpl.java From azure-keyvault-java with MIT License | 4 votes |
@Override public ServiceFuture<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags, ServiceCallback<KeyBundle> serviceCallback) { return createKeyAsync(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags, null, serviceCallback); }
Example #8
Source File: KeyVaultClientCustomImpl.java From azure-keyvault-java with MIT License | 4 votes |
@Override public Observable<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags) { return createKeyAsync(vaultBaseUrl, keyName, kty, keySize, keyOps, keyAttributes, tags, (JsonWebKeyCurveName) null); }
Example #9
Source File: AzureKeyVaultScannerTest.java From clouditor with Apache License 2.0 | 4 votes |
@BeforeAll static void setUpOnce() { discoverAssets( AzureKeyVaultScanner::new, api -> { var vault1 = createWithId(Vault.class, "vault-with-expiry", new VaultInner()); var key = createKey( "key", "key-name", new KeyBundle() .withAttributes( (KeyAttributes) new KeyAttributes().withExpires(new DateTime().plusWeeks(30)))); when(vault1.keys().list()).thenReturn(MockedPagedList.of(key)); var vault2 = createWithId(Vault.class, "vault-without-expiry", new VaultInner()); key = createKey("key", "key-name", new KeyBundle()); when(vault2.keys().list()).thenReturn(MockedPagedList.of(key)); when(api.azure.vaults().listByResourceGroup(anyString())) .thenReturn(MockedPagedList.of(vault1, vault2)); var settings = createDiagnosticsSetting( "some-id", "some-name", new DiagnosticSettingsResourceInner() .withLogs( List.of( new LogSettings() .withEnabled(true) .withRetentionPolicy( new RetentionPolicy().withEnabled(true).withDays(270))))); when(api.monitor().diagnosticSettings().listByResource(anyString())) .thenReturn(MockedPagedList.of(settings)); }); }
Example #10
Source File: CreateKeyRequest.java From azure-keyvault-java with MIT License | 4 votes |
/** * @return the key attributes */ public KeyAttributes keyAttributes() { return keyAttributes; }
Example #11
Source File: ImportKeyRequest.java From azure-keyvault-java with MIT License | 4 votes |
/** * @return the key attribute */ public KeyAttributes keyAttributes() { return keyAttributes; }
Example #12
Source File: KeyImpl.java From azure-libraries-for-java with MIT License | 4 votes |
@Override public KeyAttributes attributes() { return inner().attributes(); }
Example #13
Source File: UpdateKeyRequest.java From azure-keyvault-java with MIT License | 4 votes |
/** * @return the key attributes */ public KeyAttributes keyAttributes() { return keyAttributes; }
Example #14
Source File: KeyVaultClientCustom.java From azure-keyvault-java with MIT License | 2 votes |
/** * Creates a new key, stores it, then returns key parameters and attributes to * the client. The create key operation can be used to create any key type in * Azure Key Vault. If the named key already exists, Azure Key Vault creates a * new version of the key. * * @param vaultBaseUrl * The vault name, for example https://myvault.vault.azure.net. * @param keyName * The name for the new key. The system will generate the version * name for the new key. * @param kty * The type of key to create. For valid key types, see * JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic * Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', * 'RSA-HSM', 'oct' * @param keySize * The key size in bytes. For example, 1024 or 2048. * @param keyOps * the List<JsonWebKeyOperation> value * @param keyAttributes * the KeyAttributes value * @param tags * Application specific metadata in the form of key-value pairs. * @throws IllegalArgumentException * thrown if parameters fail the validation * @return the observable to the KeyBundle object */ Observable<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags);
Example #15
Source File: KeyVaultClientCustom.java From azure-keyvault-java with MIT License | 2 votes |
/** * Creates a new key, stores it, then returns key parameters and attributes to * the client. The create key operation can be used to create any key type in * Azure Key Vault. If the named key already exists, Azure Key Vault creates a * new version of the key. * * @param vaultBaseUrl * The vault name, for example https://myvault.vault.azure.net. * @param keyName * The name for the new key. The system will generate the version * name for the new key. * @param kty * The type of key to create. For valid key types, see * JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic * Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', * 'RSA-HSM', 'oct' * @param keySize * The key size in bytes. For example, 1024 or 2048. * @param keyOps * the List<JsonWebKeyOperation> value * @param keyAttributes * the KeyAttributes value * @param tags * Application specific metadata in the form of key-value pairs. * @throws IllegalArgumentException * thrown if parameters fail the validation * @return the observable to the KeyBundle object */ Observable<ServiceResponse<KeyBundle>> createKeyWithServiceResponseAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags);
Example #16
Source File: CreateKeyRequest.java From azure-keyvault-java with MIT License | 2 votes |
/** * Set the key attributes value. * * @param attributes * the key management attributes value to set. * @return the Builder object itself. */ public Builder withAttributes(Attributes attributes) { this.attributes = (KeyAttributes) attributes; return this; }
Example #17
Source File: KeyVaultClientCustom.java From azure-keyvault-java with MIT License | 2 votes |
/** * Creates a new key, stores it, then returns key parameters and attributes to * the client. The create key operation can be used to create any key type in * Azure Key Vault. If the named key already exists, Azure Key Vault creates a * new version of the key. * * @param vaultBaseUrl * The vault name, for example https://myvault.vault.azure.net. * @param keyName * The name for the new key. The system will generate the version * name for the new key. * @param kty * The type of key to create. For valid key types, see * JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic * Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', * 'RSA-HSM', 'oct' * @param keySize * The key size in bytes. For example, 1024 or 2048. * @param keyOps * the List<JsonWebKeyOperation> value * @param keyAttributes * the KeyAttributes value * @param tags * Application specific metadata in the form of key-value pairs. * @param serviceCallback * the async ServiceCallback to handle successful and failed * responses. * @throws IllegalArgumentException * thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ ServiceFuture<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags, final ServiceCallback<KeyBundle> serviceCallback);
Example #18
Source File: ImportKeyRequest.java From azure-keyvault-java with MIT License | 2 votes |
/** * Set the key attributes value. * * @param attributes * the key management attributes value to set * @return the Builder object itself. */ public Builder withAttributes(Attributes attributes) { this.attributes = (KeyAttributes) attributes; return this; }
Example #19
Source File: KeyVaultClientCustom.java From azure-keyvault-java with MIT License | 2 votes |
/** * Creates a new key, stores it, then returns key parameters and attributes to * the client. The create key operation can be used to create any key type in * Azure Key Vault. If the named key already exists, Azure Key Vault creates a * new version of the key. * * @param vaultBaseUrl * The vault name, for example https://myvault.vault.azure.net. * @param keyName * The name for the new key. The system will generate the version * name for the new key. * @param kty * The type of key to create. For valid key types, see * JsonWebKeyType. Supported JsonWebKey key types (kty) for Elliptic * Curve, RSA, HSM, Octet. Possible values include: 'EC', 'RSA', * 'RSA-HSM', 'oct' * @param keySize * The key size in bytes. For example, 1024 or 2048. * @param keyOps * the List<JsonWebKeyOperation> value * @param keyAttributes * the KeyAttributes value * @param tags * Application specific metadata in the form of key-value pairs. * @throws IllegalArgumentException * thrown if parameters fail the validation * @throws KeyVaultErrorException * thrown if the request is rejected by server * @throws RuntimeException * all other wrapped checked exceptions if the request fails to be * sent * @return the KeyBundle object if successful. */ KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty, Integer keySize, List<JsonWebKeyOperation> keyOps, KeyAttributes keyAttributes, Map<String, String> tags);
Example #20
Source File: UpdateKeyRequest.java From azure-keyvault-java with MIT License | 2 votes |
/** * Set the key attributes value. * * @param attributes * the key management attributes value to set * @return the Builder object itself. */ public Builder withAttributes(Attributes attributes) { this.attributes = (KeyAttributes) attributes; return this; }
Example #21
Source File: Key.java From azure-libraries-for-java with MIT License | 2 votes |
/** * @return the key management attributes. */ KeyAttributes attributes();