Skip to main content
51 votes

How to find modulus from a RSA public key?

I wanted to help break down exactly what you're seeing. If you take your base64 string: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe4eCZ0FPqri0cb2JZfXJ/...
Ian Boyd's user avatar
  • 1,001
30 votes
Accepted

How to find the encoding of an RSA public key?

The first step is to check how much data we have. That gives an idea of the size of the public modulus: although it is possible to compress an RSA public modulus $N$ to less bits than its bitlength $\...
fgrieu's user avatar
  • 142k
24 votes

Does keyless encryption exist?

Clarification I'm wondering whether there exists an encoding/hashing/encryption scheme whereby the original string can always be derived in its entirety given the entire encoded/hashed/encrypted ...
Ella Rose's user avatar
  • 19.7k
23 votes

Encoding vs. Compression vs. Encryption

OK, there seems to be some confusion with regards to terminology, so let's try to clean that up. I'll try and define things myself, but also provide the more formal Wikipedia definitions. Encryption. ...
SEJPM's user avatar
  • 46.1k
16 votes
Accepted

Using 32 hexadecimal digits vs equivalent 16-character string password

They are both equal. Passphrase security is based on the amount of entropy that the passphrase contains. In your case, both of your pieces of data are only different in the encoding. The actual ...
dusk's user avatar
  • 1,175
14 votes
Accepted

Why do we use hex output for hash functions?

Hexadecimal is traditional -- by this, I mean that there first were command-line tools that used hexadecimal for output, then other people using the hash functions found it fit to stick to hexadecimal,...
Thomas Pornin's user avatar
14 votes

Does keyless encryption exist?

Secret Sharing may be another option to consider. It allows you to take a value, break it up into arbitrarily many pieces, and possession of a subset of these pieces, not the entire set, makes ...
Ken Goss's user avatar
  • 701
9 votes

Encryption-then-encode or encode-then-encryption?

With some modes you can encode then encrypt, specifically stream cipher modes (CTR, OFB). Bit errors during transmission translate to identical bit errors in the encoded plaintext, and error ...
Richie Frame's user avatar
  • 13.1k
9 votes

Does keyless encryption exist?

OAEP - Optimal Asymmetric Encryption Padding may be what you want. In RSA public-key encryption system, in order to prevent partial decryption, OAEP padding is used. In essence, it's a Feistel ...
DannyNiu's user avatar
  • 9,436
8 votes

Do I need to worry about timing attacks in Base64 encoding/decoding of private keys?

Yes, kind of. The encoding does depend on the individual bits so there could very well be timing differences. Note that the differences would be pretty small; encoding a byte is likely much faster ...
Maarten Bodewes's user avatar
  • 93.2k
8 votes
Accepted

Does character encoding change entropy?

Technically these two strings have the same entropy I believe: We cannot tell how much entropy is in a string by looking at it, as it depends on how it is generated and if the values cannot be ...
Maarten Bodewes's user avatar
  • 93.2k
7 votes

What are I2OSP & OS2IP in RSA PKCS#1?

I2OSP and OS2IP mean Integer to Octet Stream Primitive and Octet Stream to Integer Primitive. There is an often used play on words here: "two" (2) has almost the same pronunciation as "...
Maarten Bodewes's user avatar
  • 93.2k
7 votes
Accepted

Convert plain text as numbers to encrypt using RSA

Is there any (open) standard for converting text to numbers before encrypting? Well, yes and no. There is the Unicode standard which converts each character as a single code point. But that's not ...
Maarten Bodewes's user avatar
  • 93.2k
7 votes
Accepted

Doubt regarding converting hex to byte in SHA-256 input

Let us consider a simple string in Hex: 2E Its SHA value is: cdb4ee2aea69cc6a83331bbe96dc2caa9a299d21329efb0336fc02a82e1839a8 ...
Maarten Bodewes's user avatar
  • 93.2k
6 votes
Accepted

SHA-1 requires utf-8 and reordering of bytes

Text is supposed to be utf-8 encoded / one character should be 8 bit long. this makes sense, since the same text should always return the same hash, but I couldn't find anything about it in the RFC. ...
Luis Casillas's user avatar
6 votes

Does keyless encryption exist?

A simple way to achieve this with common algorithms would be to do the following: Choose a random key (key) Encrypt the data using the random key (encrData) Hash the encrypted data (encrHash) Xor ...
webwake's user avatar
  • 161
6 votes
Accepted

Is there a consensus on what text encoding to use when hashing a string?

Hashing is done on binary, not text strings. It is the job of the character encoding to say what binary representation a string will have. After you represent the text using a particular encoding, ...
forest's user avatar
  • 15.3k
6 votes

Encrypt-then-MAC with base 64

Generally you would use encrypt-then-MAC before encoding. There is no need to process the expanded ciphertext before encoding, and you may be able to send the message both in binary and ASCII-armored ...
Maarten Bodewes's user avatar
  • 93.2k
6 votes

Restoring a point on an elliptic curve

The described method appears to be point decompression. Take care first that what you call "bytes" are actually bits. The value $k$ must be the right bit (hence $0$ or $1$), not the right byte. Below ...
Thomas Pornin's user avatar
6 votes

How to create an EC point from a plaintext message for encryption

There is also a variant of Koblitz's approach * Let the message units $m$ be integers $0<m<M$, and let $\kappa$ be a large enough integer so that we are satisfied with error probability $2^{-\...
kelalaka's user avatar
  • 49k
6 votes
Accepted

Converting raw ECC private key into ASN.1 DER encoded key

ASN.1 is a way of defining structures for data, and DER is a binary encoding of those structures. But they aren't describing any structures by themselves. Saying that something needs to be ASN.1 / DER ...
Maarten Bodewes's user avatar
  • 93.2k
5 votes

How to find modulus from a RSA public key?

You can use directly the -modulus parameter of the openssl rsa command: ...
Seki's user avatar
  • 151
5 votes
Accepted

understanding NTLM authentication

You missed some additional steps and your assumption to pass the username as plain text is not completely right. The whole authentication is done with HTTP headers containing binary messages as Base64....
Arne Burmeister's user avatar
5 votes
Accepted

What kind of ECDSA signature encoding is this?

ANS X9.62–2005 states in appendix E.8: When a digital signature is represented with ASN.1, the digital signature shall be ASN.1 encoded using the following syntax: ...
fgrieu's user avatar
  • 142k
5 votes

RSA - How to change the encrypted numerical result into text?

You don't encode the encrypted result of an RSA encryption to text; it's just a sequence of bytes. It makes no sense as "text". In network traffic such bytes can often just be sent as is, but if you'...
Henno Brandsma's user avatar
5 votes

Base64 encoding of strings

The whole purpose of base64 encoding is to take arbitary byte values and transform them into a limited subset of ASCII characters so that they can be "safely" sent (older transmission protocols could ...
Henno Brandsma's user avatar
5 votes
Accepted

finding encoding based collision

how hashing protocol generate a hash of it? Hash functions take strings of bits. They don't care what meaning these string have to the user, so it doesn't care for the fact whether these bits could ...
SEJPM's user avatar
  • 46.1k
5 votes
Accepted

How can you derive a P-256 public key from the X and Y points

There are multiple ways of encoding a EC public key in binary as well. Probably the most compatible one is a description of the generic SubjectPublicKeyInfo as used in X.509 certificates. The encoding ...
Maarten Bodewes's user avatar
  • 93.2k
5 votes
Accepted

How to create an EC point from a plaintext message for encryption

The standard approach for this goes as follows, which I think is usually attributed to this paper by Koblitz: Suppose you have a curve over an $k$-bit prime field. Also suppose you want to encode a ...
SEJPM's user avatar
  • 46.1k
5 votes
Accepted

Encrypting serialized data

If I want to encrypt structured data composed of key-value pairs of strings, would it be an advantage to use an encoding that stores keys, values and their lengths, and is padded with random numbers? ...
Maarten Bodewes's user avatar
  • 93.2k

Only top scored, non community-wiki answers of a minimum length are eligible