コード例 #1
0
    def getPubKey(self, dg15):
        """  
        Retrieve the public key in PEM format from the dataGroup15
        
        @return: A PEM reprensation of the public key
        @rtype: A string
        @raise ActiveAuthenticationException: I{The parameter type is not valid, must be a dataGroup15 object}: The parameter dg15 is not set or invalid.
        @raise ActiveAuthenticationException: I{The public key could not be recovered from the DG15}: Is open SSL installed?
        """

        if type(dg15) != type(datagroup.DataGroup15(None)):
            raise ActiveAuthenticationException(
                "The parameter type is not valid, must be a dataGroup15 object"
            )

        return self._openssl.retrieveRsaPubKey(dg15.body)
コード例 #2
0
 def algorithm(self, dg15):
     """
     Return the algorithm name used to store the signature
     @return: A string from the OID dictionnary.
     @raise ActiveAuthenticationException: I{Unsupported algorithm}: The algorithm does not exist in the OID enumeration.
     @raise ActiveAuthenticationException: I{The parameter type is not valid, must be a dataGroup15 object}: The parameter dg15 is not set or invalid.
     """
     if type(dg15) != type(datagroup.DataGroup15(None)):
         raise ActiveAuthenticationException(
             "The parameter type is not valid, must be a dataGroup15 object"
         )
     algo = ""
     try:
         spec = self._asn1Parse()
         algo = spec.getComponentByName('algorithm').getComponentByName(
             'algorithm').prettyPrint()
         return OID[algo]
     except KeyError:
         raise ActiveAuthenticationException("Unsupported algorithm: " +
                                             algo)
     except Exception as msg:
         raise ActiveAuthenticationException(
             "Active Authentication not supported: ", msg)