forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#42 from tiffanyachen/dev
Correcting implementation of EC keys to take in a hashed digest rather than the raw data
- Loading branch information
Showing
23 changed files
with
283 additions
and
111 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
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
21 changes: 7 additions & 14 deletions
21
...tography/src/main/java/com/microsoft/azure/keyvault/cryptography/algorithms/Ecdsa256.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 |
---|---|---|
@@ -1,19 +1,12 @@ | ||
package com.microsoft.azure.keyvault.cryptography.algorithms; | ||
|
||
import java.security.KeyPair; | ||
import java.security.Provider; | ||
|
||
import com.microsoft.azure.keyvault.cryptography.ISignatureTransform; | ||
|
||
public class Ecdsa256 extends Ecdsa { | ||
public final static String ALGORITHM_NAME = "NONEwithECDSA"; | ||
|
||
public Ecdsa256() { | ||
super(ALGORITHM_NAME); | ||
} | ||
|
||
protected ISignatureTransform createSignatureTransform(KeyPair key, Provider provider) { | ||
return createSignatureTransform(key, ALGORITHM_NAME, provider); | ||
} | ||
public final static String ALGORITHM_NAME = "NONEwithECDSA"; | ||
|
||
@Override | ||
public void checkDigestLength(byte[] digest) { | ||
if (digest.length != 32) { | ||
throw new IllegalArgumentException("Invalid digest length."); | ||
} | ||
} | ||
} |
20 changes: 7 additions & 13 deletions
20
...ryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/algorithms/Es256.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 |
---|---|---|
@@ -1,18 +1,12 @@ | ||
package com.microsoft.azure.keyvault.cryptography.algorithms; | ||
|
||
import java.security.KeyPair; | ||
import java.security.Provider; | ||
|
||
import com.microsoft.azure.keyvault.cryptography.ISignatureTransform; | ||
|
||
public class Es256 extends Ecdsa { | ||
public final static String ALGORITHM_NAME = "SHA256withECDSA"; | ||
|
||
public Es256() { | ||
super(ALGORITHM_NAME); | ||
} | ||
public final static String ALGORITHM_NAME = "SHA256withECDSA"; | ||
|
||
protected ISignatureTransform createSignatureTransform(KeyPair key, Provider provider) { | ||
return createSignatureTransform(key, ALGORITHM_NAME, provider); | ||
} | ||
@Override | ||
public void checkDigestLength(byte[] digest) { | ||
if (digest.length != 32) { | ||
throw new IllegalArgumentException("Invalid digest length."); | ||
} | ||
} | ||
} |
21 changes: 8 additions & 13 deletions
21
...ryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/algorithms/Es384.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 |
---|---|---|
@@ -1,18 +1,13 @@ | ||
package com.microsoft.azure.keyvault.cryptography.algorithms; | ||
|
||
import java.security.KeyPair; | ||
import java.security.Provider; | ||
public class Es384 extends Ecdsa { | ||
|
||
import com.microsoft.azure.keyvault.cryptography.ISignatureTransform; | ||
public final static String ALGORITHM_NAME = "SHA384withECDSA"; | ||
|
||
public class Es384 extends Ecdsa { | ||
public final static String ALGORITHM_NAME = "SHA384withECDSA"; | ||
|
||
public Es384() { | ||
super(ALGORITHM_NAME); | ||
} | ||
|
||
protected ISignatureTransform createSignatureTransform(KeyPair key, Provider provider) { | ||
return createSignatureTransform(key, ALGORITHM_NAME, provider); | ||
} | ||
@Override | ||
public void checkDigestLength(byte[] digest) { | ||
if (digest.length != 48) { | ||
throw new IllegalArgumentException("Invalid digest length."); | ||
} | ||
} | ||
} |
23 changes: 9 additions & 14 deletions
23
...ryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/algorithms/Es512.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 |
---|---|---|
@@ -1,18 +1,13 @@ | ||
package com.microsoft.azure.keyvault.cryptography.algorithms; | ||
|
||
import java.security.KeyPair; | ||
import java.security.Provider; | ||
|
||
import com.microsoft.azure.keyvault.cryptography.ISignatureTransform; | ||
|
||
public class Es512 extends Ecdsa { | ||
public final static String ALGORITHM_NAME = "SHA512withECDSA"; | ||
public Es512() { | ||
super(ALGORITHM_NAME); | ||
} | ||
protected ISignatureTransform createSignatureTransform(KeyPair key, Provider provider) { | ||
return createSignatureTransform(key, ALGORITHM_NAME, provider); | ||
} | ||
public final static String ALGORITHM_NAME = "SHA512withECDSA"; | ||
|
||
@Override | ||
public void checkDigestLength(byte[] digest) { | ||
if (digest.length != 64) { | ||
throw new IllegalArgumentException("Invalid digest length."); | ||
} | ||
} | ||
} |
Oops, something went wrong.