Construct a new OpenSSL BIGNUM object.
If bn
is an Integer
or OpenSSL::BN
, a new instance of OpenSSL::BN
representing the same value is returned. See also Integer#to_bn
for the short-hand.
If a String
is given, the content will be parsed according to base
.
string
The string to be parsed.
base
The format. Must be one of the following:
0
- MPI format. See the man page BN_mpi2bn(3) for details.
2
- Variable-length and big-endian binary encoding of a positive number.
10
- Decimal number representation, with a leading ‘-’ for a negative number.
16
- Hexadecimal number representation, with a leading ‘-’ for a negative number.
The string must contain a valid cipher name like “aes-256-cbc”.
A list of cipher names is available by calling OpenSSL::Cipher.ciphers
.
Creates a Digest
instance based on string, which is either the ln (long name) or sn (short name) of a supported digest algorithm. A list of supported algorithms can be obtained by calling OpenSSL::Digest.digests
.
If data (a String
) is given, it is used as the initial input to the Digest
instance, i.e.
digest = OpenSSL::Digest.new('sha256', 'digestdata')
is equivalent to
digest = OpenSSL::Digest.new('sha256') digest.update('digestdata')
Returns an instance of OpenSSL::HMAC
set with the key and digest algorithm to be used. The instance represents the initial state of the message authentication code before any data has been processed. To process data with it, use the instance method update
with your data as an argument.
key = 'key' instance = OpenSSL::HMAC.new(key, 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.class #=> OpenSSL::HMAC
Two instances can be securely compared with ==
in constant time:
other_instance = OpenSSL::HMAC.new('key', 'SHA1') #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance == other_instance #=> true
Creates an instance of OpenSSL::Config
from the content of the file specified by filename.
This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
This can raise IO
exceptions based on the access, or availability of the file. A ConfigError
exception may be raised depending on the validity of the data being configured.
Many methods in this class aren’t documented.
Creates a new Psych::Parser
instance with handler
. YAML
events will be called on handler
. See Psych::Parser
for more details.
Create a new scanner
Create a new TreeBuilder
instance
Create a new Psych::Emitter
that writes to io
.
Creates a new Ripper::Filter
instance, passes parameters src
, filename
, and lineno
to Ripper::Lexer.new
The lexer is for internal use only.
family should be an integer, a string or a symbol.
Socket::AF_INET, “AF_INET”, “INET”, :AF_INET, :INET
Socket::AF_UNIX, “AF_UNIX”, “UNIX”, :AF_UNIX, :UNIX
etc.
cmsg_level should be an integer, a string or a symbol.
Socket::SOL_SOCKET, “SOL_SOCKET”, “SOCKET”, :SOL_SOCKET and :SOCKET
Socket::IPPROTO_IP, “IP” and :IP
Socket::IPPROTO_IPV6, “IPV6” and :IPV6
Socket::IPPROTO_TCP, “TCP” and :TCP
etc.
cmsg_type should be an integer, a string or a symbol. If a string/symbol is specified, it is interpreted depend on cmsg_level.
Socket::SCM_RIGHTS, “SCM_RIGHTS”, “RIGHTS”, :SCM_RIGHTS, :RIGHTS for SOL_SOCKET
Socket::IP_RECVTTL, “RECVTTL” and :RECVTTL for IPPROTO_IP
Socket::IPV6_PKTINFO, “PKTINFO” and :PKTINFO for IPPROTO_IPV6
etc.
cmsg_data should be a string.
p Socket::AncillaryData.new(:INET, :TCP, :NODELAY, "") #=> #<Socket::AncillaryData: INET TCP NODELAY ""> p Socket::AncillaryData.new(:INET6, :IPV6, :PKTINFO, "") #=> #<Socket::AncillaryData: INET6 IPV6 PKTINFO "">
remote_address
is an Addrinfo
object.
local_address
is an Addrinfo
object.
reply_proc
is a Proc
used to send reply back to the source.
Returns a new Socket::Option
object.
sockopt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, [1].pack("i")) p sockopt #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
initialize
Returns OLE event object. The first argument specifies WIN32OLE
object. The second argument specifies OLE event name.
ie = WIN32OLE.new('InternetExplorer.Application') ev = WIN32OLE::Event.new(ie, 'DWebBrowserEvents')