2014-04-11 13:28:43 +02:00
|
|
|
Standard PEM write
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"-----START TEST-----\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8=\n-----END TEST-----\n"
|
2014-04-11 13:28:43 +02:00
|
|
|
|
|
|
|
PEM write (zero data)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"":"-----START TEST-----\n-----END TEST-----\n"
|
2014-04-11 13:28:43 +02:00
|
|
|
|
|
|
|
PEM write (one byte)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"00":"-----START TEST-----\nAA==\n-----END TEST-----\n"
|
2014-04-11 13:28:43 +02:00
|
|
|
|
|
|
|
PEM write (more than line size)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"-----START TEST-----\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8AAQIDBAUGBwgJCgsMDQ4P\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8=\n-----END TEST-----\n"
|
2014-04-11 13:28:43 +02:00
|
|
|
|
|
|
|
PEM write (exactly two lines)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F":"-----START TEST-----\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8AAQIDBAUGBwgJCgsMDQ4P\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8AAQIDBAUGBwgJCgsMDQ4P\n-----END TEST-----\n"
|
2014-04-11 13:28:43 +02:00
|
|
|
|
|
|
|
PEM write (exactly two lines + 1)
|
2015-04-08 12:49:31 +02:00
|
|
|
mbedtls_pem_write_buffer:"-----START TEST-----\n":"-----END TEST-----\n":"000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F00":"-----START TEST-----\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8AAQIDBAUGBwgJCgsMDQ4P\nAAECAwQFBgcICQoLDA0ODwABAgMEBQYHCAkKCwwNDg8AAQIDBAUGBwgJCgsMDQ4P\nAA==\n-----END TEST-----\n"
|
2016-10-24 14:31:54 +01:00
|
|
|
|
2023-05-03 14:49:28 +02:00
|
|
|
PEM write length reporting
|
|
|
|
mbedtls_pem_write_buffer_lengths
|
|
|
|
|
2022-02-07 12:47:00 +01:00
|
|
|
PEM read (unencrypted, valid)
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"^":"$":"^\nTWJlZCBUTFM=\n$":"":0:"4d62656420544c53"
|
2022-02-07 12:47:00 +01:00
|
|
|
|
2016-10-24 14:31:54 +01:00
|
|
|
PEM read (DES-EDE3-CBC + invalid iv)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_DES_C
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"^":"$":"^\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-EDE3-CBC,00$":"pwd":MBEDTLS_ERR_PEM_INVALID_ENC_IV:""
|
2016-10-24 14:31:54 +01:00
|
|
|
|
|
|
|
PEM read (DES-CBC + invalid iv)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_DES_C
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"^":"$":"^\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-CBC,00$":"pwd":MBEDTLS_ERR_PEM_INVALID_ENC_IV:""
|
2016-10-24 14:31:54 +01:00
|
|
|
|
2023-07-05 12:43:10 +01:00
|
|
|
PEM read (AES-128-CBC + invalid iv)
|
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_AES_C
|
|
|
|
mbedtls_pem_read_buffer:"^":"$":"^\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,00$":"pwd":MBEDTLS_ERR_PEM_INVALID_ENC_IV:""
|
|
|
|
|
2016-10-24 14:31:54 +01:00
|
|
|
PEM read (unknown encryption algorithm)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_CIPHER_MODE_CBC:MBEDTLS_AES_C
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"^":"$":"^\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-,00$":"pwd":MBEDTLS_ERR_PEM_UNKNOWN_ENC_ALG:""
|
2016-10-24 14:31:54 +01:00
|
|
|
|
2017-03-01 11:53:29 +00:00
|
|
|
PEM read (malformed PEM DES-CBC)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVATE KEY-----":"pwd":MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH:""
|
2017-03-01 11:53:29 +00:00
|
|
|
|
|
|
|
PEM read (malformed PEM DES-EDE3-CBC)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_DES_C:MBEDTLS_CIPHER_MODE_CBC
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: DES-EDE3-CBC,AA94892A169FA426\n\nMAAA\n-----END EC PRIVATE KEY-----":"pwd":MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH:""
|
2017-03-01 11:53:29 +00:00
|
|
|
|
|
|
|
PEM read (malformed PEM AES-128-CBC)
|
2023-03-16 10:24:47 +01:00
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
2022-02-07 12:59:10 +01:00
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,AA94892A169FA426AA94892A169FA426\n\nMAAA\n-----END EC PRIVATE KEY-----":"pwd":MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH:""
|
2024-02-09 17:44:07 +01:00
|
|
|
|
|
|
|
# The output sequence's length is not multiple of block size (16 bytes). This
|
|
|
|
# proves that the pem_context->len value is properly updated based on the SEQUENCE
|
|
|
|
# length read from the decoded ASN.1 data (i.e. extra padding, if any, is ignored).
|
|
|
|
PEM read (valid EC key encoded with AES-128-CBC)
|
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,151F851B6A7F3FBDAA5B7173117D0127\n\nLw+0OM+0Bwcl+ls/vxQbLrVshGc7bsNPvvtj2sJeMFFEq3V1mj/IO++0KK/CDhMH\nh6CZPsmgVOeM5uFpqYaq0fJbUduN2eDMWszWRm0SFkY=\n-----END EC PRIVATE KEY-----":"pwdpwd":0:"3041020101040f00d8023c809afd45e426d1a4dbe0ffa00706052b81040004a1220320000400da1ecfa53d528237625e119e2e0500d2eb671724f16deb6a63749516b7"
|
|
|
|
|
|
|
|
# The text "hello world" (which is clearly not a valid ASN.1 SEQUENCE) is encoded
|
|
|
|
# with AES-128-CBC to prove that ASN.1 parsing after decoding fails.
|
2024-02-12 11:03:16 +01:00
|
|
|
# Since PBKDF1 isn't supported in OpenSSL, here's the steps:
|
|
|
|
# 1. generate the key (password="password"; IV=0x3132333435363738 in hex or "12345678" as string)
|
|
|
|
# echo -n "password12345678" | openssl md5
|
|
|
|
# 2. encode data
|
|
|
|
# echo -n "hello world" | openssl aes-128-cbc -e -base64 -p -K "bbb0ddff1b944b3cc68eaaeb7ac20099" -iv "3132333435363738"
|
2024-02-09 17:44:07 +01:00
|
|
|
PEM read (Invalid SEQUENCE encoded with AES-128-CBC)
|
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
2024-02-12 11:03:16 +01:00
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,31323334353637380000000000000000\n\nDfRGkwS+VjvR0IYsjZwW6Q==\n-----END EC PRIVATE KEY-----":"password":MBEDTLS_ERR_PEM_INVALID_DATA + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG:""
|
|
|
|
|
|
|
|
# Same as above, but with invalid padding data.
|
|
|
|
# Generated with:
|
|
|
|
# echo -n -e "\x68\x65\x6c\x6c\x6f\x20\x77\x6f\x72\x6c\x64\x01\x02\x03\x04\x05" | openssl aes-128-cbc -e -base64 -p -K "bbb0ddff1b944b3cc68eaaeb7ac20099" -iv "3132333435363738" -nopad
|
|
|
|
PEM read (Invalid padding data for AES-128-CBC)
|
|
|
|
depends_on:MBEDTLS_MD_CAN_MD5:MBEDTLS_AES_C:MBEDTLS_CIPHER_MODE_CBC
|
|
|
|
mbedtls_pem_read_buffer:"-----BEGIN EC PRIVATE KEY-----":"-----END EC PRIVATE KEY-----":"-----BEGIN EC PRIVATE KEY-----\nProc-Type\: 4,ENCRYPTED\nDEK-Info\: AES-128-CBC,31323334353637380000000000000000\n\n333hxynfxEdXrSHQfIabxQ==\n-----END EC PRIVATE KEY-----":"password":MBEDTLS_ERR_PEM_BAD_INPUT_DATA:""
|