diff options
author | Russ Housley <housley@vigilsec.com> | 2019-05-31 01:23:02 -0400 |
---|---|---|
committer | Ilya Etingof <etingof@gmail.com> | 2019-05-31 07:23:02 +0200 |
commit | 61b5149d1b1e50a212f64846ffc90a9222f51a83 (patch) | |
tree | cc4d0f3a975f22da7b2d3b6cc210a3c6e7302666 /pyasn1_modules | |
parent | 9901a7f012fb77aa406921c9e423b2c0cb8e37e4 (diff) | |
download | pyasn1-modules-61b5149d1b1e50a212f64846ffc90a9222f51a83.tar.gz |
Add support for RFC 5915 (#40)
Diffstat (limited to 'pyasn1_modules')
-rw-r--r-- | pyasn1_modules/rfc5915.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/pyasn1_modules/rfc5915.py b/pyasn1_modules/rfc5915.py new file mode 100644 index 0000000..82ff4a3 --- /dev/null +++ b/pyasn1_modules/rfc5915.py @@ -0,0 +1,32 @@ +# This file is being contributed to pyasn1-modules software. +# +# Created by Russ Housley with assistance from asn1ate v.0.6.0. +# +# Copyright (c) 2019, Vigil Security, LLC +# License: http://snmplabs.com/pyasn1/license.html +# +# Elliptic Curve Private Key +# +# ASN.1 source from: +# https://www.rfc-editor.org/rfc/rfc5915.txt + +from pyasn1.type import namedtype +from pyasn1.type import namedval +from pyasn1.type import tag +from pyasn1.type import univ + +from pyasn1_modules import rfc5480 + + +class ECPrivateKey(univ.Sequence): + pass + +ECPrivateKey.componentType = namedtype.NamedTypes( + namedtype.NamedType('version', univ.Integer( + namedValues=namedval.NamedValues(('ecPrivkeyVer1', 1)))), + namedtype.NamedType('privateKey', univ.OctetString()), + namedtype.OptionalNamedType('parameters', rfc5480.ECParameters().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 0))), + namedtype.OptionalNamedType('publicKey', univ.BitString().subtype( + explicitTag=tag.Tag(tag.tagClassContext, tag.tagFormatSimple, 1))) +) |