Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
1473ed4c
Commit
1473ed4c
authored
Jul 22, 2024
by
Peter Züger
Committed by
Damien George
Aug 13, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests/extmod/ssl_keycert.py: Add test for PKCS8 formatted DER key.
Signed-off-by:
Peter Züger
<
zueger.peter@icloud.com
>
parent
4d6d8498
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
tests/extmod/ssl_keycert.py
tests/extmod/ssl_keycert.py
+11
-0
tests/extmod/ssl_keycert.py.exp
tests/extmod/ssl_keycert.py.exp
+1
-0
No files found.
tests/extmod/ssl_keycert.py
View file @
1473ed4c
...
...
@@ -9,6 +9,11 @@ except ImportError:
key
=
b"0
\x82\x01
9
\x02\x01\x00\x02
A
\x00\xf9\xe0
}
\xbd\xd7\x9c
I
\x18\x06\xc3\xcb\xb5\xec
@r
\xfb
D
\x18\x80\xaa
WoZ{
\xcc\xa3\xeb
!
\"\x0f
Y
\x9e
]-
\xee\xe4\t
!BY
\x9f
{7
\xf3\xf2\x8f
}}
\r
|.
\xa8
<
\t
a
\xb2\xd7
W
\xb3\xc9\x19
A
\xc3
9
\x02\x03\x01\x00\x01\x02
@
\x07
:
\x9f
h
\xa6\x9c
6
\xe1
#
\x10\xf7\x0b\xc4
Q
\xf9\x01\x9b\xee\xb9\x8a
4
\r\\\xa8\xc8
:
\xd5\xca\x97\x99\xaa\x16\x04
)
\xa8\xf9\x13\xde
q
\x0e
v`
\xa7\x83\xc5\x8b
`
\xdb\xef
\x9d\x93\xe8
g
\x84\x96\xfa
V
\\\xf4
R
\xda\xd0\xa1\x02
!
\x00\xfe
R
\xbf\n\x91
Su
\x87
L
\x98
{
\xeb
%
\xed\xfb\x06
u)@
\xfe\x1b\xde\xa0\xc6
@
\xab\xc5\xed
g
\x8e\x10
[
\x02
!
\x00\xfb\x86
=
\x85\xa4
'
\xde\x85\xb5
L
\xe0
)
\x99\xfa
L
\x8c
3A
\x02\xa8
<
\xde
w
\xad\x00\xe3\x1d\x05\xd8\xb4
N
\xfb\x02
\x08\xb0
M
\x04\x90
hx
\x88
q
\xce
w
\xd5
U
\xcb
f
\x9b\x16\xdf\x9c\xef\xd1\x85\xee\x9a
7Ug
\x02\xb0
Z
\x03
'
\x02
9
\xa0
D
\xe2
$|
\xf9\xef
z]5
\x92
rs
\xb5
+
\xfd\xe6
,
\x1c\xad
mn
\xcf\xd5
?3|
\x0e
m)
\x17\x02
5Z
\xcc
/
\xa5
?
\n\x04
%
\x9b
{N
\x9d
X
\xdd
I
\xbe\xd2\xb0\xa0\x03
BQ
\x02\x82\xc2\xe0
u)
\xbd\xb8\xaf
"
# This particular key was generated with:
# $ openssl genrsa -out key.pem 512
# $ openssl rsa -in key.pem -outform DER -out key.der
keypkcs8
=
b'0
\x82\x01
U
\x02\x01\x00
0
\r\x06\t
*
\x86
H
\x86\xf7\r\x01\x01\x01\x05\x00\x04\x82\x01
?0
\x82\x01
;
\x02\x01\x00\x02
A
\x00\xae\x07\xbb\xbf
\x8e
L
\\
G
\x91\x1b\xc4
5
\x89\x96\x0c\xca\x94\xa5\xc2
%F
\x84
z
\xea\xb2
Y
\xdd\x94
3
\x1a\xe0\x1e\xfe
%
\xd3\xbc\x85\xf0\x05\x8e
I
\xca\x83\x8b\x86\xfd\x15
P,
\xa9
t8
\xc2
s
\x11\x7f
k*[[w
\xdd\x02\x03\x01\x00\x01\x02
@?
\x02
-
\xc7\x95
Q
\xef\xf3\xaa\xfc
>]
\x7f
<
\xa3\x03\xe0\xbd\xb7\xf4\x0b\xc6\xd3
1D
\x0f\x95
cT
\x06
D9
\xed\xf0
X
\xa6\x18\xb4\xe7\x96\x8f\x91\xd6\xd7\xbf
R
\\
V
\xfd\x0e
{
\xd3\xa4
e
\xb4
M
\x01\xbb\xdf\xf1\xf0\xbc
EA
\x02
!
\x00\xd5\xd7
f
\xcc\x84\xf5
Y&
\xa7
]
\x00\x91\xc9\x8e\xb0\xf3
7
\x10
8D
\x7f
&!JJ
\x83
6
\x83\x9f\n\xf2\x0f\x02
!
\x00\xd0
W
\x0e
c
\xa6\x86
C
\xf7\x8d\xbe\xf0\xbc
2
\xe3
)|
\xbb\xd6\xbb
;
\xb2\xaf
G
\x05
S
\x0f
-
\x14
X
\n
3S
\x02
A
\xf5\xb2
0
\xcd\xa6
<<
\x8f\r
A
\xda\xb6
8<^
\x99\x12
x
\xb8\xb0\x1b\x9b\xd3
%
\x8e\xb9\xa6\xf9\xcc\xcf\x83\x02
!
\x00\xa8
.
\xee\xdd\xc0\xeb
8h
\xda\x13
^
\xb0\xfe\x7f
d
\xd9
]
\xa5
m
\xc6
6k
\xca
p`
\xe9\xaa
av
\xe4\xdd
#
\x02
!
\x00\xd1\xd0\x93\xe7
wZ
\xe0
p
\xd0
M
\x07\x9e\x13\xa7\xa7\x12\x95\x1e\x13
h0O
\xc0\x18\x1f
a
\x10
")
\x9f
&U'
# Invalid key
try
:
ssl
.
wrap_socket
(
io
.
BytesIO
(),
key
=
b"!"
)
...
...
@@ -26,3 +31,9 @@ try:
ssl
.
wrap_socket
(
io
.
BytesIO
(),
key
=
key
,
cert
=
b"!"
)
except
ValueError
as
er
:
print
(
repr
(
er
))
# Valid key in PKCS8 format, invalid cert
try
:
ssl
.
wrap_socket
(
io
.
BytesIO
(),
key
=
keypkcs8
,
cert
=
b"!"
)
except
ValueError
as
er
:
print
(
repr
(
er
))
tests/extmod/ssl_keycert.py.exp
View file @
1473ed4c
ValueError('invalid key',)
TypeError("can't convert 'NoneType' object to str implicitly",)
ValueError('invalid cert',)
ValueError('invalid cert',)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment