diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-10-08 13:15:03 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2010-10-08 13:15:03 -0400 |
commit | d2a9ccf407709aa7a2a2378f758fb4db40181684 (patch) | |
tree | 3b28a390551cba7c077a9363212e9576d83934e6 /ipalib/errors.py | |
parent | dccb386d57090869acbebe92c8da173fef770869 (diff) | |
download | freeipa-d2a9ccf407709aa7a2a2378f758fb4db40181684.tar.gz freeipa-d2a9ccf407709aa7a2a2378f758fb4db40181684.tar.xz freeipa-d2a9ccf407709aa7a2a2378f758fb4db40181684.zip |
Accept an incoming certificate as either DER or base64 in the service plugin.
The plugin required a base64-encoded certificate and always decoded it
before processing. This doesn't work with the UI because the json module
decodes binary values already.
Try to detect if the incoming value is base64-encoded and decode if
necessary. Finally, try to pull the cert apart to validate it. This will
tell us for sure that the data is a certificate, regardless of the format
it came in as.
ticket 348
Diffstat (limited to 'ipalib/errors.py')
-rw-r--r-- | ipalib/errors.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ipalib/errors.py b/ipalib/errors.py index 0d1304e0d..42d43ce64 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -1204,7 +1204,7 @@ class CertificateError(ExecutionError): errno = 4300 -class CertificateOperationError(ExecutionError): +class CertificateOperationError(CertificateError): """ **4301** Raised when a certificate operation cannot be completed @@ -1220,6 +1220,22 @@ class CertificateOperationError(ExecutionError): errno = 4301 format = _('Certificate operation cannot be completed: %(error)s') +class CertificateFormatError(CertificateError): + """ + **4302** Raised when a certificate is badly formatted + + For example: + + >>> raise CertificateFormatError(error=u'improperly formated DER-encoded certificate') + Traceback (most recent call last): + ... + CertificateFormatError: improperly formated DER-encoded certificate + + """ + + errno = 4302 + format = _('Certificate format error: %(error)s') + class MutuallyExclusiveError(ExecutionError): """ |