'Sign.'

@classmethod
def sign(cls, args):

    key = args.alg.kty.load(args.key.read())
    args.key.close()
    if (args.protect is None):
        args.protect = []
    if args.compact:
        args.protect.append('alg')
    sig = JWS.sign(payload=sys.stdin.read().encode(), key=key, alg=args.alg, protect=set(args.protect))
    if args.compact:
        six.print_(sig.to_compact().decode('utf-8'))
    else:
        six.print_(sig.json_dumps_pretty())
