forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-java
- Loading branch information
Showing
144 changed files
with
25,297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!-- | ||
Copyright Microsoft Corporation | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>azure-keyvault-core</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Microsoft Azure SDK for Key Vault Core</name> | ||
<description>This package contains Microsoft Azure Key Vault Core SDK.</description> | ||
<url>https://github.com/Azure/azure-sdk-for-java</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>The MIT License (MIT)</name> | ||
<url>http://opensource.org/licenses/MIT</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<scm> | ||
<url>scm:git:https://github.com/Azure/azure-sdk-for-java</url> | ||
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal> | ||
</properties> | ||
|
||
<developers> | ||
<developer> | ||
<id>microsoft</id> | ||
<name>Microsoft</name> | ||
</developer> | ||
</developers> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-maven-plugin</artifactId> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>2.8</version> | ||
<configuration> | ||
<excludePackageNames>com.microsoft.schemas._2003._10.serialization</excludePackageNames> | ||
<bottom><![CDATA[<code>/** | ||
<br />* Copyright (c) Microsoft Corporation. All rights reserved. | ||
<br />* Licensed under the MIT License. See License.txt in the project root for | ||
<br />* license information. | ||
<br />*/</code>]]></bottom> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.4</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>18.0</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
160 changes: 160 additions & 0 deletions
160
azure-keyvault-core/src/main/java/com/microsoft/azure/keyvault/core/IKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/** | ||
* | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.microsoft.azure.keyvault.core; | ||
|
||
import java.io.Closeable; | ||
import java.security.NoSuchAlgorithmException; | ||
|
||
import org.apache.commons.lang3.tuple.Pair; | ||
import org.apache.commons.lang3.tuple.Triple; | ||
|
||
import com.google.common.util.concurrent.ListenableFuture; | ||
|
||
|
||
/** | ||
* Interface for representing cryptographic keys with the Microsoft Azure Key | ||
* Vault libraries. | ||
*/ | ||
public interface IKey extends Closeable { | ||
|
||
/** | ||
* The default encryption algorithm for this key, using the representations | ||
* from Json Web Key Algorithms, RFC7513. | ||
* | ||
* @return The default encryption algorithm for this key. | ||
*/ | ||
String getDefaultEncryptionAlgorithm(); | ||
|
||
/** | ||
* The default key wrap algorithm for this key, using the representations | ||
* from Json Web Key Algorithms, RFC7513. | ||
* | ||
* @return The default key wrap algorithm for this key. | ||
*/ | ||
String getDefaultKeyWrapAlgorithm(); | ||
|
||
/** | ||
* The default signature algorithm for this key, using the representations | ||
* from Json Web Key Algorithms, RFC7513. | ||
* | ||
* @return The default signature algorithm for this key. | ||
*/ | ||
String getDefaultSignatureAlgorithm(); | ||
|
||
/** | ||
* The unique key identifier for this key. | ||
* | ||
* @return The key identifier | ||
*/ | ||
String getKid(); | ||
|
||
/** | ||
* Decrypts the specified cipher text. Note that not all algorithms require, | ||
* or support, all parameters. | ||
* | ||
* @param ciphertext | ||
* The cipher text to decrypt | ||
* @param iv | ||
* The initialization vector (optional with some algorithms) | ||
* @param authenticationData | ||
* Additional authentication data (optional with some algorithms) | ||
* @param authenticationTag | ||
* The authentication tag from the encrypt operation (optional | ||
* with some algorithms) | ||
* @param algorithm | ||
* The encryption algorithm to use, must be supplied | ||
* @return A ListenableFuture containing the plain text | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<byte[]> decryptAsync(final byte[] ciphertext, final byte[] iv, final byte[] authenticationData, final byte[] authenticationTag, final String algorithm) throws NoSuchAlgorithmException; | ||
|
||
/** | ||
* Encrypts the specified plain text. Note that not all algorithms require, | ||
* or support, all parameters. | ||
* | ||
* @param plaintext | ||
* The plain text to encrypt | ||
* @param iv | ||
* The initialization vector (optional with some algorithms) | ||
* @param authenticationData | ||
* Additional authentication data (optional with some algorithms) | ||
* @param algorithm | ||
* The encryption algorithm to use, defaults to the keys | ||
* DefaultEncryptionAlgorithm | ||
* @return A ListenableFuture containing the cipher text, the authentication | ||
* tag and the algorithm that was used | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<Triple<byte[], byte[], String>> encryptAsync(final byte[] plaintext, final byte[] iv, final byte[] authenticationData, final String algorithm) throws NoSuchAlgorithmException; | ||
|
||
/** | ||
* Wraps (encrypts) the specified symmetric key material using the specified | ||
* algorithm, or the keys DefaultKeyWrapAlgorithm if none is specified. | ||
* | ||
* @param key | ||
* The symmetric key to wrap | ||
* @param algorithm | ||
* The wrapping algorithm to use, defaults to the keys | ||
* DefaultKeyWrapAlgorithm | ||
* @return ListenableFuture containing the encrypted key and the algorithm | ||
* that was used | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<Pair<byte[], String>> wrapKeyAsync(final byte[] key, final String algorithm) throws NoSuchAlgorithmException; | ||
|
||
/** | ||
* Unwraps (decrypts) the specified encryped key material. | ||
* | ||
* @param encryptedKey | ||
* The encrypted key to decrypt | ||
* @param algorithm | ||
* The algorithm to use, must be supplied | ||
* @return A ListenableFuture containing the unwrapped key | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<byte[]> unwrapKeyAsync(final byte[] encryptedKey, final String algorithm) throws NoSuchAlgorithmException; | ||
|
||
/** | ||
* Signs the specified digest using the specified algorithm, or the keys | ||
* DefaultSignatureAlgorithm if no algorithm is specified. | ||
* | ||
* @param digest | ||
* The digest to sign | ||
* @param algorithm | ||
* The signature algorithm to use | ||
* @return A ListenableFuture containing the signature and the algorithm used. | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<Pair<byte[], String>> signAsync(final byte[] digest, final String algorithm) throws NoSuchAlgorithmException; | ||
|
||
/** | ||
* Verifies the supplied signature value using the supplied digest and | ||
* algorithm. | ||
* | ||
* @param digest | ||
* The digest input | ||
* @param signature | ||
* The signature to verify | ||
* @param algorithm | ||
* The algorithm to use, must be provided | ||
* @return A ListenableFuture containing a boolean result | ||
* @throws NoSuchAlgorithmException the algorithm is not valid | ||
*/ | ||
ListenableFuture<Boolean> verifyAsync(final byte[] digest, final byte[] signature, final String algorithm) throws NoSuchAlgorithmException; | ||
} |
40 changes: 40 additions & 0 deletions
40
azure-keyvault-core/src/main/java/com/microsoft/azure/keyvault/core/IKeyResolver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* | ||
* Copyright (c) Microsoft and contributors. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.microsoft.azure.keyvault.core; | ||
|
||
import com.google.common.util.concurrent.ListenableFuture; | ||
|
||
/** | ||
* Interface for representing key resolving operations with the Microsoft Azure Key | ||
* Vault libraries. | ||
*/ | ||
public interface IKeyResolver { | ||
|
||
/** | ||
* Retrieves an IKey implementation for the specified key identifier. | ||
* Implementations should check the format of the kid to ensure that it is | ||
* recognized. Null, rather than an exception, should be returned for | ||
* unrecognized key identifiers to enable chaining of key resolvers. | ||
* | ||
* @param kid | ||
* The key identifier to resolve. | ||
* @return A ListenableFuture containing the resolved IKey | ||
*/ | ||
ListenableFuture<IKey> resolveKeyAsync(String kid); | ||
} |
9 changes: 9 additions & 0 deletions
9
azure-keyvault-core/src/main/java/com/microsoft/azure/keyvault/core/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for | ||
// license information. | ||
// | ||
|
||
/** | ||
* This package contains the interface for IKey and IKeyResolver. | ||
*/ | ||
package com.microsoft.azure.keyvault.core; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<!-- | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the MIT License. See License.txt in the project root for | ||
license information. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>com.microsoft.azure</groupId> | ||
<artifactId>azure-parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>azure-keyvault-cryptography</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>Microsoft Azure SDK for Key Vault Cryptography</name> | ||
<description>This package contains Microsoft Azure SDK for Key Vault Cryptography.</description> | ||
<url>https://github.com/Azure/azure-sdk-for-java</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>The MIT License (MIT)</name> | ||
<url>http://opensource.org/licenses/MIT</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<scm> | ||
<url>scm:git:https://github.com/Azure/azure-sdk-for-java</url> | ||
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection> | ||
<tag>HEAD</tag> | ||
</scm> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<legal> | ||
<![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal> | ||
<checkstyle.skip>true</checkstyle.skip> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcprov-jdk15on</artifactId> | ||
<scope>test</scope> | ||
<version>1.54</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>azure-keyvault-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.