Class RSACore
java.lang.Object
es.gob.jmulticard.jse.provider.rsacipher.RSACore
Operaciones con claves privadas RSA.
No se soporta CRT (Chinese Remainder Theorem).
Esta clase no realiza rellenos, estos deben hacerse externamente.
Nota: Las claves RSA deben ser de al menos 512 bits.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Set of blinding parameters for a given RSA key.private static final class
Parameters (u,v) for RSA Blinding. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Map
<BigInteger, RSACore.BlindingParameters> private static final boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static byte[]
convert
(byte[] b, int ofs, int len) private static byte[]
crypt
(byte[] msg, BigInteger n, BigInteger exp) Operación general de cifrado RSA (unmodPow()
).private static RSACore.BlindingRandomPair
(package private) static int
Return the number of bytes required to store the magnitude byte[] of this BigInteger.(package private) static int
getByteLength
(RSAKey key) Devuelve el número de octetos necesarios para almacenar el módulo de una clave RSA.private static BigInteger
parseMsg
(byte[] msg, BigInteger n) Parse the msg into a BigInteger and check against the modulus n.private static byte[]
priCrypt
(byte[] msg, BigInteger n, BigInteger exp) RSA non-CRT private key operations.(package private) static byte[]
rsa
(byte[] msg, RSAPrivateKey key) Ejecuta un cifrado RSA con una clave privada.(package private) static byte[]
rsa
(byte[] msg, RSAPublicKey key) Ejecuta un cifrado RSA con una clave pública.private static byte[]
toByteArray
(BigInteger bi, int len) Return the encoding of this BigInteger that is exactly len bytes long.
-
Field Details
-
ENABLE_BLINDING
private static final boolean ENABLE_BLINDING- See Also:
-
BLINDING_CACHE
-
-
Constructor Details
-
RSACore
private RSACore()
-
-
Method Details
-
getByteLength
Return the number of bytes required to store the magnitude byte[] of this BigInteger. Do not count a 0x00 byte toByteArray() would prefix for 2's complement form. -
getByteLength
Devuelve el número de octetos necesarios para almacenar el módulo de una clave RSA.- Parameters:
key
- Clave RSA.- Returns:
- Número de octetos necesarios para almacenar el módulo de la clave proporcionada.
-
convert
static byte[] convert(byte[] b, int ofs, int len) -
rsa
Ejecuta un cifrado RSA con una clave pública.- Throws:
BadPaddingException
-
rsa
static byte[] rsa(byte[] msg, RSAPrivateKey key) throws BadPaddingException, CryptoCardException, PinException, LostChannelException Ejecuta un cifrado RSA con una clave privada.- Throws:
LostChannelException
- Si la clave es de un DNIe y se ha perdido el canal seguro.PinException
- Si la clave es de un DNIe y el PIN introducido es inválido.CryptoCardException
- Si la clave es de un DNIe y hay problemas con la tarjeta.BadPaddingException
-
crypt
Operación general de cifrado RSA (unmodPow()
).- Throws:
BadPaddingException
-
priCrypt
RSA non-CRT private key operations.- Throws:
BadPaddingException
-
parseMsg
Parse the msg into a BigInteger and check against the modulus n.- Throws:
BadPaddingException
-
toByteArray
Return the encoding of this BigInteger that is exactly len bytes long. Prefix/strip off leading 0x00 bytes if necessary. Precondition: bi must fit into len bytes. -
getBlindingRandomPair
private static RSACore.BlindingRandomPair getBlindingRandomPair(BigInteger e, BigInteger d, BigInteger n)
-