Ejemplo n.º 1
0
                         help="A file containing a RSA key")
    _parser.add_argument('-p', dest="rsa_public_file",
                         help="A file containing a public RSA key")
    _parser.add_argument("config", nargs="?", help="Server configuration")

    args = _parser.parse_args()

    if args.rsa_file:
        key = rsa_load(args.rsa_file)
    else:
        key = None

    if args.rsa_file:
        _key = rsa_priv_to_pub(args.rsa_file)
    elif args.rsa_public_file:
        _key = rsa_pub_load(args.rsa_public_file)
    else:
        _key = None
    idp_conf = import_module(args.config)
    metadata = idp_conf.CONFIG["metadata"]
    if _key:
        generateMetadata = MetadataGeneration(idp_conf.CONFIG,
            logger, idp_proxy_conf.SERVICE, publicKey=_key, privateKey=key,
            metadataList=[metadata])
    else:
        generateMetadata = None

    #noinspection PyUnboundLocalVariable
    _idp = setup_server_env(idp_proxy_conf, args.config, key)

    print SERVER_ENV["base_url"]
Ejemplo n.º 2
0
                        help="File containing a public RSA key")
    parser.add_argument('-k', dest="hmac_key",
                        help="If using a HMAC algorithm this is the key")
    parser.add_argument('-x', dest="x509_file",
                        help="File containing a X509 certificate")
    parser.add_argument("message", nargs="?",
                        help="The message to verify signature on")


    args = parser.parse_args()

    keys = {}
    if args.rsa_file:
        keys = {"rsa": [rsa_load(args.rsa_file)]}
    elif args.hmac_key:
        keys = {"hmac": [args.hmac_key]}
    elif args.x509_file:
        keys = {"rsa": [x509_rsa_loads(open(args.x509_file).read())]}
    elif args.rsa_pub_file:
        keys = {"rsa": [rsa_pub_load(args.rsa_pub_file)]}

    if args.message == "-":
        message = sys.stdin.read()
    else:
        message = args.message

    if keys:
        print verify(message, keys)
    else:
        print unpack(message)[1]
Ejemplo n.º 3
0
                        dest="hmac_key",
                        help="If using a HMAC algorithm this is the key")
    parser.add_argument('-x',
                        dest="x509_file",
                        help="File containing a X509 certificate")
    parser.add_argument("message",
                        nargs="?",
                        help="The message to verify signature on")

    args = parser.parse_args()

    keys = {}
    if args.rsa_file:
        keys = {"rsa": [rsa_load(args.rsa_file)]}
    elif args.hmac_key:
        keys = {"hmac": [args.hmac_key]}
    elif args.x509_file:
        keys = {"rsa": [x509_rsa_loads(open(args.x509_file).read())]}
    elif args.rsa_pub_file:
        keys = {"rsa": [rsa_pub_load(args.rsa_pub_file)]}

    if args.message == "-":
        message = sys.stdin.read()
    else:
        message = args.message

    if keys:
        print verify(message, keys)
    else:
        print unpack(message)[1]