def __init__( self, decode: Arg(metavar='decode-as', type=str, help='Input encoding; Guess encoding by default.') = None, encode: Arg(metavar='encode-as', type=str, help=F'Output encoding; The default is {Unit.codec}.' ) = Unit.codec, decerr: Arg.Option( '-d', choices=Handler, help='Specify an error handler for decoding.') = None, encerr: Arg.Option( '-e', choices=Handler, help='Specify an error handler for encoding.') = None, errors: Arg.Option( '-E', choices=Handler, help=('Specify an error handler for both encoding and decoding. ' 'The possible choices are the following: {choices}')) = None, ): super().__init__(decode=decode, encode=encode, decerr=Arg.AsOption(decerr or errors or 'STRICT', Handler).value, encerr=Arg.AsOption(encerr or errors or 'STRICT', Handler).value)
def __init__( self, key: Arg(help='RSA key in PEM, DER, or Microsoft BLOB format.'), swapkeys: Arg.Switch('-s', help='Swap public and private exponent.') = False, textbook: Arg.Switch('-t', group='PAD', help='Equivalent to --padding=NONE.') = False, padding: Arg.Option( '-p', group='PAD', choices=PAD, help= 'Choose one of the following padding modes: {choices}. The default is AUTO.' ) = PAD.AUTO, rsautl: Arg.Switch( '-r', group='PAD', help= 'Act as rsautl from OpenSSH; This is equivalent to --swapkeys --padding=PKCS10' ) = False, ): padding = Arg.AsOption(padding, PAD) if textbook: if padding != PAD.AUTO: raise ValueError('Conflicting padding options!') padding = padding.NONE if rsautl: if padding and padding != PAD.PKCS10: raise ValueError('Conflicting padding options!') swapkeys = True padding = PAD.PKCS10 super().__init__(key=key, textbook=textbook, padding=padding, swapkeys=swapkeys) self._key_hash = None self._key_data = None