public class RsaKey extends Object implements IKey
| Modifier and Type | Field and Description |
|---|---|
static int |
KeySize1024 |
static int |
KeySize2048 |
static int |
KeySize4096 |
| Constructor and Description |
|---|
RsaKey()
Constructor.
|
RsaKey(String kid)
Constructor.
|
RsaKey(String kid,
int keySize)
Constructor.
|
RsaKey(String kid,
int keySize,
Provider provider)
Constructor.
|
RsaKey(String kid,
KeyPair keyPair)
Constructor.
|
RsaKey(String kid,
KeyPair keyPair,
Provider provider)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
com.google.common.util.concurrent.ListenableFuture<byte[]> |
decryptAsync(byte[] ciphertext,
byte[] iv,
byte[] authenticationData,
byte[] authenticationTag,
String algorithm) |
com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Triple<byte[],byte[],String>> |
encryptAsync(byte[] plaintext,
byte[] iv,
byte[] authenticationData,
String algorithm) |
static RsaKey |
fromJsonWebKey(JsonWebKey jwk)
Converts JSON web key to RsaKey.
|
static RsaKey |
fromJsonWebKey(JsonWebKey jwk,
boolean includePrivateParameters)
Converts JSON web key to RsaKey and include the private key if set to true.
|
static RsaKey |
fromJsonWebKey(JsonWebKey jwk,
boolean includePrivateParameters,
Provider provider)
Converts JSON web key to RsaKey and include the private key if set to true.
|
String |
getDefaultEncryptionAlgorithm() |
static int |
getDefaultKeySize() |
String |
getDefaultKeyWrapAlgorithm() |
String |
getDefaultSignatureAlgorithm() |
KeyPair |
getKeyPair() |
String |
getKid() |
com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Pair<byte[],String>> |
signAsync(byte[] digest,
String algorithm) |
JsonWebKey |
toJsonWebKey()
Converts RsaKey to JSON web key.
|
com.google.common.util.concurrent.ListenableFuture<byte[]> |
unwrapKeyAsync(byte[] encryptedKey,
String algorithm) |
com.google.common.util.concurrent.ListenableFuture<Boolean> |
verifyAsync(byte[] digest,
byte[] signature,
String algorithm) |
com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Pair<byte[],String>> |
wrapKeyAsync(byte[] key,
String algorithm) |
public static int KeySize1024
public static int KeySize2048
public static int KeySize4096
public RsaKey()
throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionpublic RsaKey(String kid) throws NoSuchAlgorithmException
kid - NoSuchAlgorithmExceptionpublic RsaKey(String kid, int keySize) throws NoSuchAlgorithmException
kid - keySize - NoSuchAlgorithmExceptionpublic RsaKey(String kid, int keySize, Provider provider) throws NoSuchAlgorithmException
kid - keySize - provider - Java security provider.NoSuchAlgorithmExceptionpublic RsaKey(String kid, KeyPair keyPair)
kid - keyPair - public static int getDefaultKeySize()
public static RsaKey fromJsonWebKey(JsonWebKey jwk)
jwk - public static RsaKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters)
jwk - includePrivateParameters - true if the RSA key pair should include the private key. False otherwise.public static RsaKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider)
provider - the Java security provider.includePrivateParameters - true if the RSA key pair should include the private key. False otherwise.public JsonWebKey toJsonWebKey()
public String getDefaultEncryptionAlgorithm()
getDefaultEncryptionAlgorithm in interface IKeypublic String getDefaultKeyWrapAlgorithm()
getDefaultKeyWrapAlgorithm in interface IKeypublic String getDefaultSignatureAlgorithm()
getDefaultSignatureAlgorithm in interface IKeypublic KeyPair getKeyPair()
public com.google.common.util.concurrent.ListenableFuture<byte[]> decryptAsync(byte[] ciphertext,
byte[] iv,
byte[] authenticationData,
byte[] authenticationTag,
String algorithm)
throws NoSuchAlgorithmException
decryptAsync in interface IKeyNoSuchAlgorithmExceptionpublic com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Triple<byte[],byte[],String>> encryptAsync(byte[] plaintext, byte[] iv, byte[] authenticationData, String algorithm) throws NoSuchAlgorithmException
encryptAsync in interface IKeyNoSuchAlgorithmExceptionpublic com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Pair<byte[],String>> wrapKeyAsync(byte[] key, String algorithm) throws NoSuchAlgorithmException
wrapKeyAsync in interface IKeyNoSuchAlgorithmExceptionpublic com.google.common.util.concurrent.ListenableFuture<byte[]> unwrapKeyAsync(byte[] encryptedKey,
String algorithm)
throws NoSuchAlgorithmException
unwrapKeyAsync in interface IKeyNoSuchAlgorithmExceptionpublic com.google.common.util.concurrent.ListenableFuture<org.apache.commons.lang3.tuple.Pair<byte[],String>> signAsync(byte[] digest, String algorithm) throws NoSuchAlgorithmException
signAsync in interface IKeyNoSuchAlgorithmExceptionpublic com.google.common.util.concurrent.ListenableFuture<Boolean> verifyAsync(byte[] digest, byte[] signature, String algorithm) throws NoSuchAlgorithmException
verifyAsync in interface IKeyNoSuchAlgorithmExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*/